Date to Unix Timestamp Converter

Convert a specific date and time to its Unix epoch timestamp.

Converting Dates to Unix Timestamps

When working with time-based logic in code — setting expiry dates, scheduling future events, computing time differences — you often need to convert a human-readable date into a Unix timestamp. The Unix timestamp is the number of seconds since January 1, 1970 00:00:00 UTC, and it's the lingua franca of time in most databases and APIs.

Our converter takes a date and time input (with timezone), computes the Unix timestamp in both seconds and milliseconds, and shows the result in multiple formats. This is useful when: setting JWT expiration times (exp claim), configuring cookie max-age attributes, setting database row expiry in TTL-based systems, and creating test fixtures with specific timestamps.

Timezone handling is the trickiest part. Our converter asks for the timezone explicitly so there's no ambiguity — "midnight on February 19, 2024" is a different Unix timestamp in New York vs Tokyo. Always specify the timezone when the exact time matters for your use case.

Tips

  • JavaScript: new Date("2024-02-19T00:00:00Z").getTime() / 1000 gives the Unix timestamp for a specific UTC date.
  • PostgreSQL: EXTRACT(EPOCH FROM timestamp '2024-02-19 00:00:00+00') returns the Unix timestamp.
  • JWT exp claim is in seconds, not milliseconds. Use Math.floor(Date.now() / 1000) + 3600 for 1 hour from now.
  • When storing timestamps in databases, prefer UTC and store the Unix timestamp or an ISO 8601 string with timezone offset.

Ready to get started?

Convert Date to Epoch

New tools every week

Get notified. No spam.