简体   繁体   中英

how to convert UTC date/time into MDT and military time for react application?

I am trying to convert UTC into MDT (mountain time) format. I am not sure which moment format require to convert date time into MDT. i tried moment.fromOADate(41493) but not working. TIA!

If you're worried about accounting for daylight savings time and can't just subtract 6 hours, you might also look into the moment.js timezone library .

You could say something like is described here and do var zone = moment.tz.zone('America/Chihuahua') (this is mountain time), then get your time offset with zone.parse(utcTimestamp)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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