1001Ferramentas
⏱️Generators

Random Timestamp Generator

Generate random Unix timestamps within a date range. Useful for test data.


  

Random Unix timestamps explained

A random Unix timestamp generator emits integer values that represent absolute instants in time, free of timezone ambiguity. The Unix timestamp (also known as POSIX time or epoch time) is the number of seconds elapsed since 1970-01-01 00:00:00 UTC — the Unix epoch. It is the canonical way to store time in databases, log files, JWT tokens, HTTP headers and any system that needs a portable, monotonic clock value.

Resolutions: seconds, milliseconds, microseconds, nanoseconds

A timestamp can be expressed at four common resolutions. Knowing which one a system expects is critical — feeding milliseconds to a parser that wants seconds yields the year +53000:

  • Seconds — 10 digits today (e.g. 1748390400). Used by Linux time_t, PHP time(), Postgres EXTRACT(EPOCH FROM ...) and JWT iat/exp.
  • Milliseconds — 13 digits. The default in JavaScript (Date.now()) and Java (System.currentTimeMillis()).
  • Microseconds — 16 digits. Used by Python time.time_ns()/1000 and high-precision logs.
  • Nanoseconds — 19 digits. Go time.Now().UnixNano(), Java Instant.toEpochNano() and OpenTelemetry traces.

The Year 2038 problem

A signed 32-bit integer can hold values up to 2^31 − 1 = 2147483647. As a Unix timestamp in seconds, that maxes out at 2038-01-19 03:14:07 UTC. One second later it wraps to −2147483648, i.e. 1901-12-13. This is the Y2038 problem. Mitigation has been to move time_t to 64-bit signed integers — pushing the overflow to year 292277026596. Most modern OS kernels, databases and languages have completed the migration; embedded firmware and legacy COBOL are the remaining stragglers.

Converting between epoch and ISO 8601

Cookbook for switching between Unix integer and the human-readable ISO 8601 format (2026-05-28T15:30:00Z):

JavaScript:  new Date(unix * 1000).toISOString()
Python:      datetime.fromtimestamp(unix, tz=timezone.utc).isoformat()
PHP:         date('c', $unix)
Go:          time.Unix(unix, 0).UTC().Format(time.RFC3339)
SQL (PG):    to_timestamp(unix) AT TIME ZONE 'UTC'

Negative values are valid and represent instants before the epoch. The Apollo 11 moon landing of 1969-07-20 lands near -14182940. Most parsers accept negatives; a few legacy ones treat them as errors.

UTC, leap seconds and clock sync

UTC (Coordinated Universal Time) is the modern atomic-clock standard. GMT (Greenwich Mean Time) is the historical equivalent — same offset, different formal definition. Unix time tracks UTC but with one quirk: it does not count leap seconds. Every day in Unix time has exactly 86400 seconds, so on a leap-second day the system clock either repeats a second or smears it across the hour. The last leap second was inserted at 2016-12-31 23:59:60 UTC; the IERS has signalled that none will be issued until at least 2035.

Servers stay aligned with UTC via NTP (Network Time Protocol) over UDP port 123. chronyd and ntpd are the standard Linux daemons. A correctly synced server is typically within 10 ms of true UTC.

FAQ

Can I generate timestamps in the past? Yes — the date pickers above accept any range, including pre-1970 (which produces negative values).

Seconds or milliseconds — which one does my system want? JavaScript, Java and most JSON APIs use milliseconds. Linux syscalls, Postgres, MySQL UNIX_TIMESTAMP(), JWT and most logging frameworks use seconds. If a value has 10 digits it's seconds; 13 digits it's milliseconds.

What is this useful for? Seeding test databases with realistic created_at/updated_at columns, generating mock log streams for ingest pipelines, fuzzing date parsers, building load tests with varied event times, populating fixtures for Grafana/Kibana demos.

Does the output respect leap seconds? No — like every standard Unix timestamp, it assumes 86400 seconds per day. For science use cases where leap seconds matter (GPS, astronomy), use TAI (International Atomic Time) instead.

Related Tools