Moment.js转换为日期对象

使用Moment.js,我无法将正确的矩对象转换为带有时区的日期对象。我找不到正确的日期

示例:

var oldDate=new Date(),
momentObj=力矩(旧日期).tz(“MST7MDT”),
newDate=momentObj.toDate();
console.log(“开始日期”+旧日期)
log(“使用偏移量从时刻开始格式化”+momentObj.Format())
console.log(“从无偏移的时刻开始格式化”+momentObj.utc().Format())
console.log(((日期对象)带偏移量的时间“+newDate)
console.log(“(日期对象)不带偏移量的时间”+矩.utc(newDate.toDate())

使用此选项将力矩对象转换为日期对象:

从http://momentjs.com/docs/#/displaying/as-javascript日期/

矩().toDate();

收益率:

2014年11月4日星期二14:04:01 GMT-0600(CST)

发表评论