[英]moment.js offset by one day issue
Some of my users report different outputs, offset by one day. 我的一些用户报告不同的输出,偏移一天。
Code: 码:
var call=[1451084400000,1451170800000,1451257200000,1451343600000,1451430000000,1451516400000,1451602800000,1451689200000,1451775600000]
var arrayLength = call.length;
for (var i = 0; i < arrayLength; i++) {
document.getElementById('output').innerHTML += moment(call[i],"x").format("YYYY-MM-DD")+"<br>"
}
Expected result: 预期结果:
2015-12-26
2015-12-27
2015-12-28
2015-12-29
2015-12-30
2015-12-31
2016-01-01
2016-01-02
2016-01-03
Issue: 问题:
2015-12-25
2015-12-26
2015-12-27
2015-12-28
2015-12-29
2015-12-30
2015-12-31
2016-01-01
2016-01-02
Any ideas why? 有什么想法吗?
Try to convert to the desired timezone. 尝试转换为所需的时区。 For London timezone should be like this:
对于伦敦时区应该是这样的:
date.clone().tz("Europe/London");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.