Code snippets / PHP
Convert a PHP Unix timestamp to a date
PHP returns seconds directly from `time()`, no division needed. Format them with `date()` (server-local) or `gmdate()` (UTC).
Parse ISO 8601 strings with `strtotime()`, which understands most common formats including `2025-08-02T12:00:00Z`.
Current Unix timestamp (seconds)
$now = time();
echo $now; // 1,754,136,000 Convert epoch seconds → human-readable (UTC)
echo gmdate('Y-m-d H:i:s', 1754136000); // 2025-08-02 12:00:00
// or server-local time:
echo date('Y-m-d H:i:s', 1754136000); Convert ISO 8601 → epoch seconds
$ts = strtotime('2025-08-02T12:00:00Z');
echo $ts; // 1754136000 Example values used above: epoch seconds = 1,754,136,000 · ISO 8601 = 2025-08-02T12:00:00.000Z
Need more languages? Browse all the Unix timestamp code snippets. Curious how the numbers work? See the Unix epoch time FAQ, or view the current epoch time in any timezone.
Epoch → Human Date
Try it live — convert any timestamp in PHP-friendly format.
Seconds or milliseconds — the unit is auto-detected. Example: 1735689600
Waiting for input…
UTC ISO 8601
–
Local — auto
–
RFC 2822 / GMT
–
Seconds value
–
Relative time
–