🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

unix-timestamp

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unix-timestamp

Tiny library to create and manipulate Unix timestamps

0.1.1
Source
npm
Version published
Weekly downloads
30K
2.07%
Maintainers
1
Weekly downloads
 
Created
Source

unix-timestamp

Tiny library to create and manipulate Unix timestamps in Javascript. (A Unix timestamp is the number of seconds elapsed since Unix epoch time, i.e. January 1 1970 00:00 UTC.)

NPM version

Usage

Install with npm install unix-timestamp, then:

  • timestamp.now([delta]) gives the current time, optionally applying a delta (see below)
  • timestamp.fromDate(dateOrString) gives the time from a Javascript Date object or an ISO 8601 date string
  • timestamp.add(time, delta) applies a delta to the given time
  • timestamp.duration(delta) gives the delta timestamp for the given delta string

A delta can be either a number (unit: seconds) or a string with format [+|-] [{years}y] [{months}M] [{weeks}w] [{days}d] [{hours}h] [{minutes}m] [{seconds}s] [{milliseconds}ms] (for example -30s).

Tests

Install dev dependencies with npm install, then npm test.

License

Revised BSD license

Keywords

timestamp

FAQs

Package last updated on 15 Feb 2014

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