EpochTools
Web

Unix Timestamps in PHP

Core time(), date(), and DateTimeImmutable functions.

Complete PHP Recipe

<?php
// 1. Current timestamp
$currentSec = time();
$currentMs  = (int)(microtime(true) * 1000);

// 2. Convert timestamp (1710000000) to human-readable date
$utcDate   = gmdate('Y-m-d H:i:s', 1710000000); // UTC
$localDate = date('Y-m-d H:i:s', 1710000000);   // Server local

// 3. Using DateTimeImmutable
$dt = (new DateTimeImmutable("@1710000000"))->setTimezone(new DateTimeZone('UTC'));
echo $dt->format(DateTimeInterface::ATOM); // ISO 8601

Test With Live Converter

Epoch → Human Date

Paste any Unix timestamp. The unit is auto-detected from its magnitude.

Auto-detects seconds, milliseconds, microseconds, or nanoseconds. Example: 1735689600

Detected:Auto (Seconds)

UTC ISO 8601

–

Local — auto

–

RFC 2822 / GMT

–

Seconds Value

–

Relative Time

–