如何将 EST 日期格式转换为纪元?
How to convert a EST dateformat to epoch?
我需要帮助将 2014-11-30T04:57:55.000-08:00
日期格式转换为纪元时间。请帮忙。
更新
当我使用momentjs时
var temp = "2014-11-30T04:57:55.000-08:00";
console.log(temp);
console.log(moment(temp).unix());
var d = new Date(moment(temp).unix());
console.log(d);
var translateDateWithTimeTooltip = function(value) {
if (value == null || value == undefined)
return value;
var monthNames = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
var myDate = new Date( value );
return myDate.getDate() + " " + monthNames[myDate.getMonth()] + " "+myDate.getFullYear()+ " "+myDate.getHours()+":"+myDate.getMinutes();
}
它给了我下面的结果
2014-11-30T04:57:55.000-08:00
1417352275
17 Jan 1970 15:12
Sat Jan 17 1970 15:12:32 GMT+0530 (India Standard Time)
Link to world time buddy IST 时间不正确。
使用moment,就是
moment("2014-11-30T04:57:55.000-08:00").unix()
我需要帮助将 2014-11-30T04:57:55.000-08:00
日期格式转换为纪元时间。请帮忙。
更新
当我使用momentjs时
var temp = "2014-11-30T04:57:55.000-08:00";
console.log(temp);
console.log(moment(temp).unix());
var d = new Date(moment(temp).unix());
console.log(d);
var translateDateWithTimeTooltip = function(value) {
if (value == null || value == undefined)
return value;
var monthNames = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
var myDate = new Date( value );
return myDate.getDate() + " " + monthNames[myDate.getMonth()] + " "+myDate.getFullYear()+ " "+myDate.getHours()+":"+myDate.getMinutes();
}
它给了我下面的结果
2014-11-30T04:57:55.000-08:00
1417352275
17 Jan 1970 15:12
Sat Jan 17 1970 15:12:32 GMT+0530 (India Standard Time)
Link to world time buddy IST 时间不正确。
使用moment,就是
moment("2014-11-30T04:57:55.000-08:00").unix()