timezone-conversions
Functionality
-
Convert datetime from one timezone to another
-
Get current datetime of any timezone
Installation
npm install timezone-conversions
Usage
const { Convert_TZ, CurrentDateTime } = require("timezone-conversions");
Convert_TZ("YYYY-MM-DD HH:mm:ss", from_timezone, to_timezone);
CurrentDateTime(timezone);
Reference
Supported timezones https://en.wikipedia.org/wiki/List_of_time_zones_by_country
Supported datetime formats for timezone conversions
Format | Example |
---|
YYYY-MM-DDTHH:mm:ss | 2021-03-19T10:15:00 |
YYYY-MM-DD HH:mm:ss | 2021-03-19 10:15:00 |
YYYY-MM-DD HH:mm:ss A | 2021-03-19 10:15:00 AM |
YYYY-MM-DD HH:mm:ss:SSS | 2021-03-19 10:15:00:000 |
YYYY-MM-DD HH:mm | 2021-03-19 10:15 |
License
© 2021 Aman Latkar amanlatkar.com, MIT license.