I am located in the PDT timezone. When I type in new Date()
into the browser's console, I get Tue Aug 31 2021 09:43:15 GMT-0700 (Pacific Daylight Time)
.
Now, I want the date in the same format from the central time region.
So I want the time object to look like this: Aug 31 2021 11:43:15 GMT-0500 (Central Daylight Time)
I've been reading the docs about Intl, Intl.DateTimeFormat() and toLocalTimeString() but can't seem to find it.
I tried new Date().toLocaleString(undefined, { timeZone: "US/Central" })
which gives me "8/31/2021, 11:46:30 AM", which is correct but not the right format.
I tried new Intl.DateTimeFormat('en-US', { dateStyle: 'full', timeStyle: 'long', timeZone:"US/Central" }).format(new Date())
which also gives me a string and not a date object in UTC format.
What am I doing wrong?