am using moment in nodejs server to convert local time from frontend to utc.
my time format is date = '10-07-2020 08:45 PM'
in string format. When i use moment(date).format()
its converting format to this 2020-10-07 20:45:00+05:30
timezone is adding based on server and i have timezone = '+4:00'
this is my local timezone. I would like to convert my date string to UTC based on the timezone
field not based on the server timezone. How can I do this?
I tried the following methods but am not getting a proper solution
moment.utc(moment(date).utcOffset(timezone)).format('YYYY-MM-DD HH:mm:ss')
Anyone Please suggest
Instead of moment, perhaps use intl DateTimeFormat?
Here are some possibilities