Ude*_*esh 1 timezone date momentjs
如何使用 Moment.js 2.0.0+ 将表示纽约、纽约日期和时间的日期时间字符串更改为澳大利亚墨尔本?
我在 StackOverflow 上找到的其他答案已经过时或与我的用例略有不同。
convert this string '2016-04-28 09:30:00' to its Melbourne Australia equivalent
Run Code Online (Sandbox Code Playgroud)
简单地:
var s = moment.tz('2016-04-28 09:30:00', // input date time string
'YYYY-MM-DD HH:mm:ss', // format of input
'America/New_York') // time zone of input
.tz('Australia/Melbourne') // convert to another time zone
.format('YYYY-MM-DD HH:mm:ss'); // format output string
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1387 次 |
| 最近记录: |