开发者

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

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 stri开发者_JAVA百科ng.


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...


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜