2013-04-29 126 views
-4

如何使這樣一個JavaScript格式,使用日期函數:javascript日期格式2010年6月23日上午12:00

Jun 23, 2010 12:00 AM 
+7

請看看右側本頁標題爲「相關」 – zerkms 2013-04-29 03:42:14

+0

相關和/或重複:http://stackoverflow.com/questions/15151902/javascript-equivalent-for-vbscript-now-and-time/15152044#15152044 http:// stackoverflow。 com/questions/605971/format-date-in-javascript?rq = 1 http://stackoverflow.com/questions/1056728/formatting-a-date-in-javascript?rq=1 – SomeShinyObject 2013-04-29 03:43:07

+0

http://momentjs.com/ – 2013-04-29 03:43:42

回答

0

http://jsfiddle.net/tqwEE/

var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; 

var date = new Date(); 

console.log(months[date.getMonth()] + " " + date.getDate() + ", " + (date.getYear()+1900) + " " + date.getHours() + ":" + date.getMinutes()); 

//Example Output: Apr 28, 2013 20:47 
相關問題