Example 1 — Format a Timestamp in UTC
Turn a fixed timestamp into readable strings.
<?php
$ts = 1700000000;
echo gmdate('Y-m-d H:i:s', $ts), PHP_EOL;
echo gmdate('l, d F Y', $ts), PHP_EOL;
echo gmdate('D, d M Y H:i:s', $ts) . ' GMT', PHP_EOL; How It Works
- The first format prints the common database style, year-month-day then time.
- l is the full weekday name and F is the full month name.
- D and M are the short weekday and month names, used in HTTP date headers.
- ' GMT' is added with the dot operator because the result is always UTC.

