Skip to content

Unix timestamp converter

Convert Unix seconds or milliseconds to dates in UTC and your time zone, and convert a date back to a timestamp.

Runs in your browser. Nothing you paste is sent to us.

Timestamp to date

Paste an exp, iat or nbf value. A sample is filled in.

Read as
Unix seconds
UTC
2025-11-24T16:00:00.000ZMon, 24 Nov 2025 16:00:00 GMT
Seconds
1764000000What JWT claims use
Milliseconds
1764000000000What JavaScript Date uses

Date to timestamp

Unix seconds
1764000000
Milliseconds
1764000000000
ISO 8601 (UTC)
2025-11-24T16:00:00.000Z

How to use it

  1. Paste a timestamp, such as a token’s exp, or a date.
  2. The unit is detected from the number of digits; pick it yourself if needed.
  3. Read the date in UTC, in your time zone and relative to now.
  4. Or pick a date and time to get its Unix seconds and milliseconds.

What to know

Unix time counts seconds since 1 January 1970 UTC. JWT claims such as exp, iat and nbf use seconds.

JavaScript and many APIs use milliseconds instead. A 13-digit number is almost always milliseconds.

Keycloak tokens use seconds, while the Keycloak admin REST API returns times such as a user’s createdTimestamp in milliseconds.

What a Unix timestamp is

A Unix timestamp counts the seconds since 00:00:00 UTC on 1 January 1970, a moment called the Unix epoch. It is a single number with no time zone, which makes it easy to store, compare and send between systems.

Tokens, logs, databases and APIs use it everywhere. In JWTs, the claims exp, iat, nbf and auth_time are Unix seconds; RFC 7519 calls this a NumericDate. Reading them as dates is the first step in most token debugging.

Seconds, milliseconds and more

Not every system counts in seconds. JavaScript’s Date.now(), Java’s System.currentTimeMillis() and many APIs use milliseconds. Some logs and databases use microseconds or nanoseconds. The number of digits tells you which, for dates near the present.

UnitDigits for current datesExample for 2025-11-24 16:00 UTC
Seconds101764000000
Milliseconds131764000000000
Microseconds161764000000000000
Nanoseconds191764000000000000000

This converter detects the unit from the number of digits, and you can set it yourself when a value is ambiguous.

What this converter does

  • Turns a timestamp into a date in UTC (ISO 8601 and RFC 7231 style), in your time zone, and relative to now.
  • Gives the value in both seconds and milliseconds.
  • Also accepts a date string such as 2026-11-25T10:00:00Z and turns it into a timestamp.
  • Turns a date and time you pick, in UTC or in your time zone, into seconds, milliseconds and ISO 8601.
  • Shows the current time as Unix seconds, updated every second.

How to convert

  1. Paste a timestamp, for example an exp value from a token.
  2. Check the “Read as” line to confirm the unit; change it if needed.
  3. Read the date in UTC and in your time zone.
  4. To go the other way, pick a date and time, say whether it is UTC, and copy the seconds.

How the conversion works

Converting seconds to a date is a multiplication and a call to the date library: the browser’s Date works in milliseconds, so seconds are multiplied by 1000. Converting back divides by 1000 and rounds down.

Seconds to a date and back in JavaScript
const exp = 1764000300;
new Date(exp * 1000).toISOString();   // "2025-11-24T16:05:00.000Z"
Math.floor(Date.now() / 1000);       // current Unix seconds

Unix time ignores leap seconds: every day is exactly 86,400 seconds. That keeps arithmetic simple and is why adding 3600 always means one hour later.

Timestamps in Keycloak

Keycloak uses both units, depending on where you look.

WhereUnit
Token claims: exp, iat, auth_timeSeconds
Introspection responses: exp, iatSeconds
Admin REST API: a user’s createdTimestampMilliseconds
Admin REST API: event time valuesMilliseconds

Mixing the two is a classic source of bugs: comparing a token’s exp with Date.now() without dividing makes every token look expired by decades, or valid forever, depending on the direction.

Logs are another common source. Keycloak’s own server log prints readable dates, but events and admin events fetched through the admin REST API carry their time in milliseconds. Paste such a value here to read it in your time zone.

Use cases

Reading a token’s expiry

Paste the exp value to see when a token stops working. For all of a token’s times on one timeline, use the expiry checker.

Writing a test token

Pick a date a few minutes ahead, copy the seconds, and use them as exp in the JWT encoder.

Reading logs and events

Paste a time from a Keycloak event or an application log to see when it happened in your own time zone.

Comparing times across systems

Convert values from two systems to UTC to check whether a “not yet valid” or “expired” error comes from a clock difference.

Common mistakes

  • Using milliseconds in a JWT claim. Libraries expect seconds and will misread the value.
  • Converting a timestamp “to a time zone”. A timestamp has no time zone; only its display does.
  • Parsing a date string without a zone. 2026-11-25T10:00 is read as local time in most environments; add Z or an offset to be exact.
  • Assuming 32-bit storage is enough. Signed 32-bit seconds run out in January 2038.

Timestamps in different languages

Every platform can produce and read Unix time, but the default unit differs. These lines all produce seconds.

Getting the current Unix time in seconds
# shell
date +%s
date -u -d @1764000000          # GNU date: seconds to a UTC date

// JavaScript
Math.floor(Date.now() / 1000)

# Python
int(time.time())

// Java
Instant.now().getEpochSecond()

On macOS, date -r 1764000000 converts seconds to a date, because the BSD date command does not support -d @.

Databases add their own conventions. PostgreSQL’s to_timestamp(1764000000) turns seconds into a timestamp with time zone, and extract(epoch from now()) goes the other way, with a fractional part. MySQL has FROM_UNIXTIME and UNIX_TIMESTAMP. When a column holds numbers, check whether they are seconds or milliseconds before converting.

Spreadsheets count days, not seconds, from their own epoch. To turn Unix seconds into a spreadsheet date, divide by 86,400 and add the spreadsheet’s value for 1 January 1970.

ISO 8601 and time zones

ISO 8601 is the readable companion to Unix time. A full value such as 2025-11-24T16:00:00Z names the date, the time and the zone. The Z means UTC; an offset such as +01:00 means one hour ahead of UTC.

  • 2025-11-24T16:00:00Z and 2025-11-24T17:00:00+01:00 are the same moment.
  • 2025-11-24T16:00:00 without a zone is ambiguous; most software reads it as local time.
  • 2025-11-24 alone is usually read as midnight UTC in JavaScript, but as local midnight in other tools.

When you send times between systems, include the zone, or send Unix seconds. This converter’s date input lets you say whether the time you pick is UTC or local, so the result is never ambiguous.

Doing date arithmetic with timestamps

Because Unix time counts plain seconds, arithmetic is simple. That is one reason tokens use it.

SpanSeconds
One minute60
Five minutes, Keycloak’s default access token lifespan300
One hour3,600
One day86,400
One week604,800

To build a token that expires in 10 minutes, take the current seconds and add 600. To find a token’s lifetime, subtract iat from exp. To check how long ago a user signed in, subtract auth_time from now.

Calendar arithmetic is different. Adding “one month” or “one day” across a daylight-saving change in a local time zone is not a fixed number of seconds; use a date library for that, and keep tokens in plain seconds.

Inside a JWT, the arithmetic is always done in seconds. A refresh that is due 30 seconds before expiry happens at exp - 30, whatever the user’s time zone or daylight-saving rules. That is exactly why token formats avoid calendar dates and local times.

When you write such values by hand, convert a date here once, then add the span from the table. It is less error-prone than converting every value separately.

Limits

The converter handles dates the browser’s Date can represent, more than 270,000 years either side of 1970. Values outside that range are refused. Detection by digit count assumes dates within a few centuries of now; for anything else, set the unit yourself.

The current time comes from your computer’s clock. If it is wrong, “relative” times are wrong too.

Best practices

  • Store and send times as UTC timestamps or ISO 8601 with a zone; convert to local time only for display.
  • Name fields by unit when you design an API, such as createdAtMs, to avoid confusion.
  • Use 64-bit integers for timestamps.
  • Keep server clocks synced with NTP so timestamps from different machines agree.
Questions

Frequently asked questions

How do I tell seconds from milliseconds?

Count the digits. Dates around now have 10 digits in seconds and 13 in milliseconds.

Does Unix time have a time zone?

No. It is always counted from the epoch in UTC. Only the way it is shown changes with the time zone.

Are JWT `exp` and `iat` in seconds?

Yes. RFC 7519 defines them as NumericDate, seconds since the epoch. A millisecond value in a JWT is a bug.

How do I get the current Unix time?

In JavaScript, `Math.floor(Date.now() / 1000)`. In a shell, `date +%s`. This page also shows it, updated every second.

What happens in 2038?

Signed 32-bit integers can count seconds only until 03:14:07 UTC on 19 January 2038. Systems that store timestamps in 32 bits will overflow then; 64-bit storage avoids it.

Why is Keycloak’s `createdTimestamp` so long?

The admin REST API returns it in milliseconds, so it has 13 digits. Divide by 1000 to compare it with token times.

Does Unix time count leap seconds?

No. Every day counts as exactly 86,400 seconds, so leap seconds are not represented.

How do I convert a timestamp in a shell?

With GNU date, `date -u -d @1764000000` prints the UTC date. On macOS, use `date -u -r 1764000000`. To go the other way, `date +%s` prints the current time in seconds.

Why is my converted date off by a few hours?

The timestamp is right, but it is being shown in a different time zone than you expect, or a date string without a zone was read as local time. Compare the UTC value to rule out display issues.

Can a Unix timestamp be negative?

Yes. Negative values count seconds before 1970, so `-86400` is 31 December 1969. Token claims are never negative in practice.

Rather not run Keycloak yourself?

We run it for you on a cluster of your own, with backups, upgrades and written support. Starter and Premium begin with a 7-day trial.