简体   繁体   中英

How to convert time string to indian standard time in React Js?

i am trying to get local time, from the only time string. i am getting the api response with only time string like 12:30 PM, I have Tried like below but its not working when the time is 00:00(i am getting 5:30 am) , but it is working for the other time, i have also tried using moment-timezone, but whenever my time is 00:00 i am geting 05:30 AM

{moment.utc(user.checkin_time, 'hh:mm A').local().format('hh:mm A')}

最后在@pilchard 的帮助下我找到了答案

moment.utc(user.checkin_time, 'hh:mm A').tz('Asia/Kolkata').format('hh:mm A')

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