请看这些日期时间值的格式:在JavaScript中,如何将日期时间值从一种格式转换为另一种格式?
var from = "2012-01-13 T11:00:00";
var to = "13 Jan 2012 11:00am";
在上述例子中,如何写一个JavaScript函数,其在“从”格式在“到”格式转换的值的值,既日期时间值的文本obvioulsy。
var to = convertDateTime(from);
function convertDateTime(from)
{
// how to implement this?
}
非常感谢,
可能的重复[如何将字符串转换为日期时间与JavaScript格式规范?](http://stackoverflow.com/questions/476105/how-can-i-convert-string-to-datetime-with- format-specification-in-javascript) – 2012-02-29 12:44:19
希望这篇文章对你有所帮助。 http://stackoverflow.com/questions/758999/converting-dates-in-javascript – Learner 2012-02-29 12:47:12