Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

date2timestamp

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

date2timestamp

> Convert a date to its UNIX epoch timestamp

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

date2timestamp

Convert a date to its UNIX epoch timestamp

I needed to convert dates to timestamps for time tracking and scheduling things to go live. This helps with that.

Usage

Get timestamp for today at midnight (00:00):

date2timestamp
# Example output: 1478498400

Get timestamp for some other day (2020-08-26):

date2timestamp -y 2020 -m 8 -d 26
# Output: 1598418000

Get timestamp for really specific time (2020-08-26 at 03:55:12):

date2timestamp -y 2020 -m 8 -d 26 -H 3 -M 55 -S 12
# Output: 1598432112

NOTE: Need to convert a timestamp back to a human-readable date? Run:

# Linux / GNU-based
date -d @1267619929

# macOS / BSD-based
date -r <timestamp>

Install

Option 1: use yarn or npm

If using npm:

npm i -g date2timestamp

If using Yarn:

yarn global add date2timestamp

Option 2: manual installation

License

MIT

FAQs

Package last updated on 20 Nov 2017

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