Staaarter

Convert Human Time to UNIX Time

Parses a human-readable UTC date and time in "YYYY-MM-DD HH:MM:SS" format and converts it into the equivalent UNIX timestamp, the number of whole seconds since January 1, 1970. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-08-05
By Staaarter Team
conversiontimestamp

Overview

Introduction

Plenty of systems, logs, and APIs need a UNIX timestamp, but it's much easier to think about a specific moment as a readable date and time.

This tool takes a human-readable UTC date and time and converts it into the equivalent UNIX timestamp in seconds.

What Is Convert Human Time to UNIX Time?

A human-time-to-UNIX-time converter that parses a "YYYY-MM-DD HH:MM:SS" UTC date and time and returns the corresponding whole-second timestamp.

It's the reverse counterpart to Convert UNIX Time to Human Time, and the two tools use the same UTC-only convention so a value round-trips cleanly between them.

How Convert Human Time to UNIX Time Works

The input is validated against a strict pattern for year, month, day, hour, minute, and second, then each field's range is checked (month 01-12, hour 00-23, minute and second 00-59).

The fields are passed to `Date.UTC()` to build a UTC timestamp in milliseconds, which is then divided by 1000 and floored to produce the whole-second UNIX timestamp, after confirming the date didn't silently roll over to a different day.

When To Use Convert Human Time to UNIX Time

Use it when you need to convert a specific readable date and time into a UNIX timestamp for a script, API call, or database query.

It's also useful for verifying that a timestamp you're about to hardcode actually corresponds to the moment you intend.

Features

Advantages

  • Always interprets input as UTC, avoiding ambiguity from a browser's local timezone.
  • Accepts dates before 1970, producing correct negative timestamps.
  • Validates each field's range and rejects dates that don't actually exist, like April 31.

Limitations

  • Only accepts UTC input; there's no option to specify a different source timezone.
  • Produces seconds, not milliseconds, so multiply by 1000 if your target system expects millisecond timestamps.

Examples

Converting a specific UTC date and time

Input

2026-08-05 14:30:00

Output

1785940200

August 5, 2026 at 14:30:00 UTC is 1,785,940,200 whole seconds after the UNIX epoch.

Converting the epoch itself

Input

1970-01-01 00:00:00

Output

0

Midnight UTC on January 1, 1970 is, by definition, UNIX timestamp 0.

Best Practices & Notes

Best Practices

  • Enter times as UTC even if you're thinking in a local timezone; convert to UTC first if needed.
  • Use Convert UNIX Time to Human Time afterward to double-check a converted timestamp reads back correctly.

Developer Notes

Validation uses `/^(-?\d{1,6})-(\d{2})-(\d{2})[ T](\d{2}):(\d{2}):(\d{2})(?:\s*UTC)?$/` followed by explicit range checks on month/hour/minute/second, then `Date.UTC(year, month - 1, day, hour, minute, second)` builds the millisecond timestamp, which is round-tripped through `getUTCFullYear`/`getUTCMonth`/`getUTCDate` to reject dates that don't exist, before being divided by 1000 and floored for the final result.

Convert Human Time to UNIX Time Use Cases

  • Converting a human-readable deadline or scheduled time into a UNIX timestamp for code or an API payload
  • Preparing timestamp test fixtures with a known, specific date and time
  • Verifying a hand-typed timestamp actually corresponds to the intended moment

Common Mistakes

  • Entering a local time instead of UTC, which produces a timestamp offset from what was intended.
  • Expecting a millisecond result; the output is always in whole seconds.

Tips

  • Pair with Convert UNIX Time to Human Time to round-trip and confirm a conversion.
  • Use UNIX Time Sequence Generator afterward if you need a run of consecutive timestamps starting from your converted value.

References

Frequently Asked Questions