today's date in php code example
Example 1: php today date
<?php
echo "Today is " . date("Y/m/d") . "<br>";
echo "Today is " . date("Y.m.d") . "<br>";
echo "Today is " . date("Y-m-d") . "<br>";
echo "Today is " . date("l");
Example 2: date now php
date("Y-m-d H:i:s");
Example 3: Get the Current Date and Time in PHP
phpCopy<?php
$Object = new DateTime();
$DateAndTime = $Object->format("d-m-Y h:i:s a");
echo "The current date and time are $DateAndTime.";
?>
Example 4: how to set date in php
$date = new DateTime;
$date->setDate(1999,02,19);