I used to format timezone using moment-timezone and I use tz().format()
and got result 04:25PM UTC+07:00
now it turn my friend move from moment-timezone to date-fns, im trying to achieve what i achieve using moment-timezone, but what i get is in GMT formatted like this 04:25 PM GMT+7
I have read the documentation of date-fns but i could not find format the date to UTC+7
this is code I have tried
formatInTimeZone('2022-09-12T09:25:19.789Z', 'Asia/Bangkok', 'hh:mm a zzz')
format( utcToZonedTime('2022-09-12T09:25:19.789Z', 'Asia/Bangkok'), 'hh:mm a zzz',{ timeZone: 'UTC' })
i still could not get like 04:25PM UTC+07:00
what i expected is 04:25PM UTC+07:00
what i got is 04:25 PM GMT+7
i think you can use this instead , add manually +800
const TIME_FORMAT_24 = 'HH:mm a +0800';
format(
utcToZonedTime(new Date(), timezone),
TIME_FORMAT
);