How to convert yyyy-mm-dd formatted date to 'long date' format using jquery?

后端 未结 4 1164
故里飘歌
故里飘歌 2021-01-22 13:18

I have date in yyyy-mm-dd format. It is found to be ISO Date format. I need to convert it to Long Date format.

eg: I have date as \'2015-07-15\'. The converted date for

4条回答
  •  有刺的猬
    2021-01-22 13:48

    var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
    
    var current_date = new Date("2015-07-15");
    month_value = current_date.getMonth();
    day_value = current_date.getDate();
    year_value = current_date.getFullYear();
    
    document.write("Converted date is : " + 
    day_value +" "+ months[month_value] + " " + year_value);

    Check discussion and many other solution here : Get month name from Date

提交回复
热议问题