timezone-conversions
Advanced tools
Comparing version 1.1.2 to 1.1.3
{ | ||
"name": "timezone-conversions", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Convert DateTime from one timezone to another", | ||
@@ -10,3 +10,5 @@ "main": "index.js", | ||
"local-datetime", | ||
"UTC-to-local-datetime" | ||
"UTC-to-local-datetime", | ||
"datetime", | ||
"node-datetime" | ||
], | ||
@@ -13,0 +15,0 @@ "repository": { |
@@ -7,5 +7,5 @@ # timezone-conversions | ||
1. Convert Date Time From One time timezone to another | ||
1. Convert datetime from one timezone to another | ||
2. Get Current Date Time of any timezone | ||
2. Get Current datetime of any timezone | ||
@@ -18,26 +18,26 @@ ## Installation | ||
## Convert Date Time from one time timezone to another | ||
```javascript | ||
const { Convert_TZ, CurrentDateTime } = require("timezone-conversions"); | ||
```javascript | ||
const { Convert_TZ } = require("timezone-conversions"); | ||
let convertedDatetime = Convert_TZ( | ||
"yyyy-mm-dd hh:mm:ss", | ||
from_timezone, | ||
to_timezone | ||
); | ||
/* let convertedDatetime = Convert_TZ( | ||
"2021-03-19 10:00:00", | ||
"+11:00", | ||
"-04:00" | ||
); */ | ||
console.log(convertedDatetime); | ||
// Convert datetime from one time timezone to another | ||
Convert_TZ("YYYY-MM-DD HH:mm:ss", from_timezone, to_timezone); | ||
// Convert_TZ("2021-03-19 10:15:00", "+05:30", "+07:00"); => 2021-03-19 12:45:00 +07:30 | ||
// Get Current datetime of any timezone | ||
CurrentDateTime(timezone); | ||
// CurrentDateTime("+05:30"); => 2021-03-20 02:12:00 +05:30 | ||
``` | ||
## Get Current Date Time of any timezone | ||
```javascript | ||
const { CurrentDateTime } = require("timezone-conversions"); | ||
let Datetime = CurrentDateTime(timezone); | ||
//let Datetime = CurrentDateTime("+05:30") | ||
console.log(Datetime); | ||
``` | ||
## Reference | ||
Check 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 Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5145