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

time

Package Overview
Dependencies
Maintainers
0
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

time

"time.h" bindings for NodeJS

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
393
decreased by-1.01%
Maintainers
0
Weekly downloads
 
Created
Source

node-time

"time.h" bindings for NodeJS.

This module offers simple bindings for the C time.h APIs. It also extends the regular Date object with a setTimeZone function, which isn't normally part of JavaScript.

Example

var time = require('time');

// Create a new Date instance
var now = new Date();

now.setTimeZone("America/Los_Angeles");
// `.getDate()`, `.getDay()`, `.getHours()`, etc.
// will return values according to UTC-8

now.setTimeZone("America/New_York");
// `.getDate()`, `.getDay()`, `.getHours()`, etc.
// will return values according to UTC-5

Be sure to request any additional features by creating a GitHub Issue requesting it!

API

The time module itself exports some functions as well:

time() -> Number

Binding for time(3). Returns the number of seconds since Jan 1, 1900 UTC.

tzset() -> Undefined

Binding for tzset(3). Sets up the internal timezone information based on the current process.env.TZ value. This must be called after a change to the TZ environment variable.

localtime(Number) -> Object

Binding for localtime(). Accepts a Number with the number of seconds since the Epoch (i.e. the result of time()), and returns a "broken-down" Object representation of the timestamp, according the the currently configured timezone (see tzset()).

FAQs

Package last updated on 10 Mar 2011

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