To convert GMT (Greenwich Mean Time) to Australian Eastern Daylight Time in TypeScript, you can use the Moment.js library. Moment.js provides an easy and intuitive way to manipulate and display dates and times in various time zones.
Here's an example code snippet that demonstrates how to convert a GMT date-time string to Australian Eastern Daylight Time string.
index.ts287 chars7 lines
In the code snippet above, we first import the Moment.js library. We then define a gmtDateTime
variable containing a GMT date-time string (in ISO format). Next, we use the Moment.js moment()
function to parse the GMT date-time string and create a moment object. We then use the tz()
function to convert the moment object from GMT to Australian Eastern Daylight Time by specifying the 'Australia/Sydney' time zone. Finally, we use the format()
function to convert the moment object to a string, which is in the ISO format with the local time zone offset (+11:00).
The resulting value of ausDateTime
is a string representing the Australian Eastern Daylight Time version of the input date-time in ISO format.
gistlibby LogSnag