Skip to content

DateTime Class

The DateTime class provides an object-oriented interface for working with dates and times.

$date = new DateTime();
echo $date->format("Y-m-d H:i:s");
$date = new DateTime("2025-01-01");
echo $date->format("Y-m-d");