且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用moment.js将UTC JSON日期时间转换为本地日期时间

更新时间:2023-02-03 17:28:25

  var  tmp = moment(   / Date(1433309688000)/)。utcOffset('  + 10:29')。format('  YYYY-MM-DD HH:mm :SS' 跨度>); 
alert(tmp);





你也可以试试这个http://momentjs.com/timezone/[^]


How to convert an UTC JSON date time eg:/Date(1433309688000)/ to local date time based on user's timezone using moment.js.

The expected result for the json date /Date(1433309688000)/ in Indian Standard Time is 2015-06-03 16:03:21.

var tmp =  moment("/Date(1433309688000)/").utcOffset('+10:29').format('YYYY-MM-DD HH:mm:ss');
alert(tmp);



you can try this http://momentjs.com/timezone/[^] too .