日期不正确
当我的系统偏好&用户偏好相同
jsfiddle示例:http://jsfiddle.net/uq99udc9/728/
//system preference Asia/Kolkata
// input date America/Los_Angeles --- 2016-11-09 02:00:00
var date = new Date("2016-11-09 02:00:00");
var gmtdate = date.toGMTString(); -- converting into GMT
$("#divThai").text(moment.tz(gmtdate,'Asia/Kolkata'));
$("#divUsa").text(moment.tz(gmtdate,'America/Los_Angeles'));
任何人都可以帮助我解决这个问题。
先谢谢,
答案 0 :(得分:0)
试试这个:
// Parse the date in Los Angeles timezone.
const date = moment.tz('2016-11-09 02:00:00', 'America/Los_Angeles');
// Output the date.
console.log(date.toString());
// Output the date in Asia/Kolkata timezone.
console.log(date.tz('Asia/Kolkata').toString());

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.2/moment-with-locales.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.9/moment-timezone-with-data.min.js"></script>
&#13;