To convert from GMT to Australian Central Daylight Time (ACDT), we can use the toLocaleString()
method in JavaScript. However, we need to first set the timezone for our date object to the GMT timezone. We can achieve this by creating a new Date
object with our GMT time and then setting its timezone to UTC (Coordinated Universal Time, which is the equivalent of GMT).
Here's the code:
index.ts198 chars5 lines
In this example, we have created a new Date
object with a GMT time of 2022-01-17T03:30:00.000Z
. We then use the toLocaleString()
method to convert this to the ACDT timezone by passing the locale as "en-AU"
and the timezone as "Australia/Adelaide"
. This will return the ACDT time in the format dd/mm/yyyy, h:mm:ss am/pm
.
gistlibby LogSnag