To convert Hawaiian Time (Hawaii–Aleutian Standard Time, HST) to Greenwich Mean Time (GMT), we need to first get the respective UTC offsets for both time zones. Hawaii Standard Time is 10 hours behind Coordinated Universal Time (UTC-10), while Greenwich Mean Time is equal to Coordinated Universal Time (UTC+0).
Here's a TypeScript function that takes a date/time string in Hawaiian Time as input, and returns the equivalent date/time in GMT:
index.ts556 chars13 lines
Example usage:
index.ts145 chars5 lines
Note that the toISOString()
method returns a UTC string with a 'Z' suffix denoting the timezone offset of +00:00 (GMT/UTC).
gistlibby LogSnag