2.3.2 • Published 3 months ago

time-converter-by-timezone v2.3.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

time-converter-by-timezone

Convert Timezone is a lightweight npm package that simplifies the process of converting time from one timezone to another. Whether you need to convert from Current timezone time to Australia/Perth or any other timezone, this package handles the conversion seamlessly. Simply input the current timezone time and the target timezone, and Convert Timezone will provide the equivalent time in the desired timezone, making timezone conversions hassle-free.

Install package using npm

npm i time-converter-by-timezone

Install package using yarn

yarn add time-converter-by-timezone

Usage

Convert current timezone date to target timezone date

// Note: Current timezone will pick automatically

import { convertTimeToTargetTimezone } from "time-converter-by-timezone";

const time = convertTimeToTargetTimezone(
	"02/25/2024, 11:00:00 AM", // You can pass time as you want in any date format
	"Australia/Perth" // Target timezone
);
console.log("time: ", time);
// time: 2024-02-25T03:00:00.000Z
console.log("Local string: ", new Date(time).toLocaleString());
// Local string: 25/2/2024, 8:30:00 am

// Australia/Perth timezone is 2:30 hours ahead of Asia/Calcutta timezone
// Hence when 8:30 AM Asia/Calcutta equals to 11 AM Australia/Perth time

Convert date to one timezone to target timezone date. You can get date/time that refers target timezone

import { oneTimezoneToTargetTimezone } from "time-converter-by-timezone";

const time = oneTimezoneToTargetTimezone(
	"02/25/2024, 11:00:00 AM", // You can pass time as you want in any date format
	"Asia/Calcutta", // You can mention your timezone
	"Australia/Perth" // Target timezone
);
console.log("time = ", time);
// time: 2024-02-25T03:00:00.000Z
console.log("Local string = ", new Date(time).toLocaleString());
// Local string: 25/2/2024, 8:30:00 am

// Australia/Perth timezone is 2:30 hours ahead of Asia/Calcutta timezone
// Hence when 8:30 AM Asia/Calcutta equals to 11 AM Australia/Perth time
2.3.0

3 months ago

2.2.1

3 months ago

2.1.2

3 months ago

2.2.0

3 months ago

2.1.1

3 months ago

2.3.2

3 months ago

2.2.3

3 months ago

2.0.5

3 months ago

2.3.1

3 months ago

2.2.2

3 months ago

2.0.4

3 months ago

2.0.7

3 months ago

2.0.6

3 months ago

2.1.0

3 months ago

2.0.3

3 months ago

2.0.2

3 months ago

2.0.1

3 months ago

2.0.0

3 months ago

1.1.1

3 months ago

1.1.0

3 months ago

1.0.0

3 months ago