I have a string "2024-09-19 14:20:45" in given time zone say "America/Los_Angeles".
In javascript how can I convert it to datetime string in another time zone "timezone2" say "America/New_York" (three hours earlier than Los Angeles)?
How can I get "2024-09-19 17:20:45" in the above example for "America/New_York" in Javascript ?
2
Answers
In this approach:
new Date(): We parse the string and assume it’s UTC.
Intl.DateTimeFormat: This is used to format the date into the desired time zone, America/New_York.
Lets try that in Luxon, since JS has crummy timezone handling