简体   繁体   English

Moment.js中的时区显示格式

[英]Time zone display formatting in Moment.js

I am using moment.js to get the date from my cordova application. 我正在使用moment.js从我的cordova应用程序中获取日期。

expected output 预期产量

2017-06-04T10:17:00+0530 2017-06-04T10:17:00 + 0530

Current output 电流输出

2017-06-04T10:17:00+05:30 2017-06-04T10:17:00 + 05:30

Code

var date=moment(enddate).format("YYYY-MM-DDThh:mm:ssZ")
console.log(date);

So how can i get the date as 2017-06-04T10:17:00+0530 this format? 那么如何获取这种格式的日期为2017-06-04T10:17:00+0530

Try ZZ instead of Z for the time zone ( from the docs ) 在时区中尝试使用ZZ而不是Z来自docs

var date=moment(enddate).format("YYYY-MM-DDThh:mm:ssZZ")
                                                     ^

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM