CURRENT EPOCH · EPOCHTIME.TOOLS · A PRECISION INSTRUMENT FOR TIME
Converter Batch Difference Blog
Languages
JavaScript Python TypeScript Go Rust Java PHP SQL Bash
Specialty
LDAP Timestamp .NET Ticks Chrome/WebKit Cocoa / Core Data Discord Timestamp Excel OADate Unix Hex
Standards
ISO 8601 Guide Year 2038 NTP Timestamp GPS Time Julian Day
01 Input
Paste an NTP timestamp (10-digit integer) or a date string
NTP epoch is 1900-01-01 UTC. Offset from Unix epoch: 2208988800 seconds (70 years).
02 Output
NTP seconds
Unix seconds
Unix milliseconds
ISO 8601 (UTC)
Human-readable

What is an NTP timestamp?

The Network Time Protocol (NTP) is the standard for synchronizing computer clocks over the internet. NTP packets include a 64-bit timestamp consisting of two 32-bit halves:

You'll encounter NTP timestamps when:

The Year 2036 problem

The 32-bit seconds field will overflow on February 7, 2036 at 06:28:16 UTC — earlier than the Unix Y2038 boundary. NTP version 4 partially addresses this by using "eras," but legacy NTP v3 and earlier implementations will fail at this boundary.

Conversion formulas

NTP → Unix seconds

unix_seconds = ntp_seconds - 2208988800

Unix seconds → NTP

ntp_seconds = unix_seconds + 2208988800

The constant 2208988800 is the number of seconds between 1900-01-01 00:00:00 UTC and 1970-01-01 00:00:00 UTC (exactly 70 years including 17 leap days).

Code examples

Python

from datetime import datetime, timezone

NTP_OFFSET = 2208988800

def ntp_to_datetime(ntp_seconds: int) -> datetime:
    return datetime.fromtimestamp(ntp_seconds - NTP_OFFSET, tz=timezone.utc)

def datetime_to_ntp(dt: datetime) -> int:
    return int(dt.timestamp()) + NTP_OFFSET

JavaScript

const NTP_OFFSET = 2208988800;

function ntpToDate(ntpSec) {
  return new Date((ntpSec - NTP_OFFSET) * 1000);
}

function dateToNtp(date) {
  return Math.floor(date.getTime() / 1000) + NTP_OFFSET;
}

C (parsing an NTP packet)

#include <stdint.h>
#include <time.h>

#define NTP_TIMESTAMP_DELTA 2208988800ULL

time_t ntp_to_unix(uint32_t ntp_seconds) {
    return (time_t)(ntp_seconds - NTP_TIMESTAMP_DELTA);
}

uint32_t unix_to_ntp(time_t unix_seconds) {
    return (uint32_t)(unix_seconds + NTP_TIMESTAMP_DELTA);
}

The fractional part (for the curious)

The lower 32 bits of an NTP timestamp represent fractional seconds in 2-32 units. To convert to a decimal fraction:

fractional_seconds = ntp_fraction / 4294967296.0

The resolution is about 233 picoseconds per unit — far more precision than any practical computer clock can provide. In typical use you can ignore the fractional part entirely; it only matters for high-precision time sync.