Socket
Socket
Sign inDemoInstall

node-clock

Package Overview
Dependencies
1
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-clock

A simple clock for node.js apps


Version published
Weekly downloads
36
decreased by-10%
Maintainers
1
Install size
1.50 MB
Created
Weekly downloads
 

Readme

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

Last updated on 26 Sep 2013

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc