Last active
July 1, 2020 00:20
-
-
Save chrisjensen/cb712e5df53809d94322b01af167b4d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const tzc = require('timezonecomplete'); | |
const SingaporeTime = tzc.TimeZone('Singapore/Singapore'); | |
const MelbourneTime = tzc.TimeZone('Australia/Melbourne'); | |
const timeInSingapore = new tzc.DateTime('2019-12-01 08:30', SingaporeTime); | |
// Same UTC time, different offset | |
timeInSingapore.convert(MelbourneTime); | |
// 2019-12-01 11:30am | |
timeInSingapore.format('yyyy-MM-dd HH:mm'); | |
const timeInSingapore = new tzc.DateTime('2019-12-01 08:30', SingaporeTime); | |
// 8:30am in Melbourne (different UTC time) | |
mel = new tzc.DateTime(timeInSingapore.format('YYYY-MM-dd HH:mm'), MelbourneTime); | |
// 2019-12-01 08:30am | |
timeInSingapore.format('yyyy-MM-dd HH:mm'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment