格式日期在jquery-从星期三三月03 2012 14:16:05 GMT + 0530到03/03/2012
我该如何格式化这个日期?
Sat Mar 03 2012 14:16:05 GMT+0530 (India Standard Time)
我使用了新的date()函数来获取此li中的日期。 我想要这样的日期03/03/2012
function dateFormat(){ var d = new Date(); date = d.getDate(); date = date < 10 ? "0"+date : date; mon = d.getMonth()+1; mon = mon < 10 ? "0"+mon : mon; year = d.getFullYear() return (date+"/"+mon+"/"+year); } dateFormat();
您需要做的就是告诉日期函数将日期格式化为您想要的输出类型。
(假设您使用的是JavaScript的日期函数,您在上面提到过。)
http://www.webdevelopersnotes.com/tips/html/10_ways_to_format_time_and_date_using_javascript.php3
要么
http://blog.stevenlevithan.com/archives/date-time-format
要么
http://archive.plugins.jquery.com/project/jquery-dateFormat