Get started with epoch CDN

MIT licensed

Epoch library: Consistent date handling across browsers.

Tags:
  • epoch

Stable version

Copied!

How to start using epoch CDN


// Include the epoch library from the CDN
const Epoch = require('epoch.full.min');

// Create a new epoch instance
const epoch = new Epoch();

// Parse a date string to an epoch moment
const date = epoch.parse('2022-01-01T12:34:56Z');

// Get the Unix timestamp in milliseconds
const unixTimestamp = date.to('millisecond');

// Output the Unix timestamp
console.log(unixTimestamp); // Output: 1641312896000
Copied!
Copied!
Copied!
Copied!

All versions