2014-07-17 67 views
0

我有以下其中Moment.js時間格式錯誤

moment(13:00:00,'ddd, DD MMM YYYY HH:mm:ss ZZ').format('HH:mm'); 

我期待13:00,但我不斷收到5:45這是GMT我猜。

此外,

moment(13:00:00,'ddd, DD MMM YYYY HH:mm:ss ZZ').format('HH:mm am'); 
I should get 1:00am but O'm getting 5:45am. 

做解決問題下列

moment(13:00:00,"hh:mm a").format('hh:mm a'); 

moment(13:00:00,"HH:mm").format('HH:mm'); 

回答

1

輸入字符串需要周圍的引號。

另外,您傳遞的格式應與數據匹配。

moment("13:00:00","HH:mm:ss").format("HH:mm")