Javascript日期格式Jun 23,2010 12:00 AM

时间:2013-04-29 03:40:11

标签: javascript

如何使用日期函数在javascript中制作这样的格式:

Jun 23, 2010 12:00 AM

1 个答案:

答案 0 :(得分: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