To convert GMT to New Zealand time in JavaScript, you can use a library like moment.js
to handle timezone conversions. Here's an example code block:
index.tsx298 chars11 lines
In the code above, we first set the date in GMT format using moment.utc()
. Then, we use the tz()
function to convert the date to the New Zealand time zone. Finally, we format the date in the desired output format using the format()
function.
gistlibby LogSnag