Skip to content
Justice Tech School

Dates

date() formats a timestamp, mktime and strtotime create timestamps and DateTime is the modern API.

Example
echo date("Y-m-d", 86400 * 365), "\n";
$d = new DateTime("2026-03-15");
$d->modify("+10 days");
echo $d->format("D, d M Y");

Result

1971-01-01
Wed, 25 Mar 2026

Exercise

Format a date.

("Y-m-d")

Quiz Test

Which class is the modern date API?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.