Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-clock

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-clock

A simple clock for node.js apps

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

node-clock

This node.js module provides a simple clock abstraction.

Build Status

Install

npm install node-clock

Usage

var clock = require('clock');
 
> clock.tzids
[ 'UTC', 'America/Los_Angeles', 'America/Denver', 'America/Chicago', 'America/New_York' ]

> clock.utc('2012-03-11T09:00:00.000')
Date.parse('2012-03-11T09:00:00.000Z').valueOf()

> date = new Date(clock.pacific('2012-01-01 09:00'));
> clock.utc(date.valueOf(), "%m/%d/%Y %H:%M")
'01/01/2012 17:00'

> clock.tz('2012-04-01 12:00', clock.pacific.tzid)
Date.parse('2012-04-01T19:00:00.000Z').valueOf()

> clock.tz('2012-04-01 12:00', 'America/Denver')
Date.parse('2012-04-01T18:00:00.000Z').valueOf()

> clock.tz('2012-04-01 12:00', 'America/Chicago')
Date.parse('2012-04-01T17:00:00.000Z').valueOf()

> clock.tz(date.valueOf(), "%m/%d/%Y %H:%M", clock.pacific.tzid)
'01/01/2012 09:00'

> clock.tz(date.valueOf(), "%m/%d/%Y %H:%M", 'America/Denver')
'01/01/2012 10:00'

> clock.tz(date.valueOf(), "%m/%d/%Y %H:%M", 'America/Chicago')
'01/01/2012 11:00'

> clock.tz(date.valueOf(), "%m/%d/%Y %H:%M", 'America/New_York')
'01/01/2012 12:00'

> clock.tz(date.valueOf(), "%m/%d/%Y %H:%M", 'UTC')
'01/01/2012 17:00'

Keywords

FAQs

Package last updated on 26 Sep 2013

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc