How to format this date type 2010-06-24T00:00:00Z to sun,24/06/10 7.15 p.m (CDT) using javascript or jquery

故事扮演 提交于 2019-12-20 07:28:35

问题


How to format this date type 2010-06-24T00:00:00Z to sun,24/06/10 7.15 p.m (CDT) using JavaScript or jQuery.?

sun,24/06/10 7.15 p.m (CDT) is just a format representation which I need and not the actual date of the above string.


回答1:


Pretty simple with JS -

var d_names = new Array("sun", "mon", "tue", "wed", "thu", "fri", "sat");
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
curr_month++;
var curr_year = d.getFullYear();
document.write(d_names[curr_day] + ", " +curr_month + "/" + curr_date + "/" + curr_year);

and bob's your uncle...




回答2:


I recommend jQuery Globalization Plugin from Microsoft

http://weblogs.asp.net/scottgu/archive/2010/06/10/jquery-globalization-plugin-from-microsoft.aspx

example:

jQuery.format(new Date(1955,10,5), "dddd MMMM d, yyyy"); // Saturday November 5, 1955


来源:https://stackoverflow.com/questions/3215508/how-to-format-this-date-type-2010-06-24t000000z-to-sun-24-06-10-7-15-p-m-cdt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!