Current epoch — epochtime.tools · A precision instrument for time

Get the current Unix timestamp

const ms = Date.now();
const seconds = Math.floor(Date.now() / 1000);
// Microseconds since 1970 from the high-resolution clock
const us = Math.round((performance.timeOrigin + performance.now()) * 1000);

Convert a Unix timestamp to a date

new Date(1700000000 * 1000).toISOString();   // '2023-11-14T22:13:20.000Z'
new Date(1700000000123).toISOString();          // milliseconds go in as-is

Convert a date to a Unix timestamp

Date.UTC(2026, 10, 14, 10) / 1000;                     // 1794650400 (months are 0-based)
Date.parse('2026-11-14T15:30:00+05:30') / 1000;         // 1794650400

Timezones

new Intl.DateTimeFormat('en-GB', {
  timeZone: 'Asia/Kolkata', dateStyle: 'medium', timeStyle: 'long'
}).format(new Date(1700000000 * 1000));
// e.g. '15 Nov 2023, 03:43:20 GMT+5:30'

// The server's own zone comes from the TZ environment variable:
//   TZ=UTC node app.js

Common mistakes

  • process.hrtime.bigint() is monotonic: good for measuring durations, but it is not a Unix time.
  • File times: fs.statSync(p).mtimeMs is milliseconds with a fraction. Pass { bigint: true } to get exact mtimeNs.
  • Containers often run with TZ unset, so local time is UTC there and your laptop's zone at home. Store and log UTC.

Complete example

import { statSync } from 'node:fs';

console.log('Now (s):', Math.floor(Date.now() / 1000));
const st = statSync(import.meta.filename, { bigint: true });
console.log('This file was modified at', st.mtimeNs, 'ns since 1970');
const t0 = process.hrtime.bigint();
setTimeout(() => console.log('Waited', Number(process.hrtime.bigint() - t0) / 1e6, 'ms'), 100);

Check any value with the epoch converter, or convert a whole column with the batch converter. All examples use 1700000000 (2023-11-14 22:13:20 UTC) and 1794650400 (2026-11-14 10:00:00 UTC).

Official documentation

Last updated: