🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

my-timezone

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

my-timezone

Get the exact time based on your location.

Source
npmnpm
Version
1.7.7
Version published
Weekly downloads
11
-96.6%
Maintainers
1
Weekly downloads
 
Created
Source

my-timezone License: GPL v3 npm version

Get the exact time based on your location by calculating the time difference in seconds from UTC (good explanation on CS4FN).

Prerequisites

  • Node.js >= 14
  • npm (preinstalled) or yarn

Installation

ℹ️ This is a pure ESM module.

Add the module to your project with yarn add my-timezone or install it globally with yarn global add my-timezone.

Usage

TypeScript

import {MyTimezone} from 'my-timezone';

new MyTimezone()
  .getTimeByAddress('Berlin, Germany')
  .then(date => {
    console.log(date.toString()); // Sun Sep 03 2017 14:29:49 GMT+0200
  })
  .catch(error => console.error(error));

// or

new MyTimezone()
  .getTimeByLocation('13.394')
  .then(date => {
    console.log(date.toString()); // Sun Sep 03 2017 14:29:49 GMT+0200
  })
  .catch(error => console.error(error));

CLI

Usage: my-timezone [options] <location>

Get the exact time based on your location.
Use a city name or longitude value as location.

Options:

  -V, --version  output the version number
  -o, --offline  Work offline (default is false)
  -s, --server   Specify the NTP server (default is "pool.ntp.org")
  -h, --help     output usage information

FAQs

Package last updated on 16 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts