adding current date a variable in php code example
Example 1: php code to display current date and time in different formats
echo date('Y.m.d H:i:s');
Example 2: php date
$dateTime = new \DateTime();
/**
* You can get the string by using format
*/
$dateTime->format('Y-m-d H:i:s');