如何将EST日期格式转换为纪元?

时间:2015-01-16 09:16:42

标签: javascript angularjs momentjs

我需要帮助才能将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时间不正确。

1 个答案:

答案 0 :(得分:0)

使用片刻,它只是

moment("2014-11-30T04:57:55.000-08:00").unix()