timestamper.online
Back to Guides

How to Handle Unix Timestamps in PHP

Timestamp manipulation in PHP using `time()` and `DateTime`.

1. Get Current Timestamp
php
// Get current timestamp
$now = time();
echo $now;
2. Convert Date to Timestamp
php
// String to timestamp
$ts = strtotime("2024-01-01 00:00:00 UTC");
3. Convert Timestamp to Readable Date
php
// Timestamp to readable format
echo date('Y-m-d H:i:s', 1704067200);

Need to convert a specific timestamp right now?

Use Online Converter