Is there a PHP function that returns the date and time in the same format as the MySQL function NOW()?
NOW()
I know how to do it using date(), b
date()
Use this function:
function getDatetimeNow() { $tz_object = new DateTimeZone('Brazil/East'); //date_default_timezone_set('Brazil/East'); $datetime = new DateTime(); $datetime->setTimezone($tz_object); return $datetime->format('Y\-m\-d\ h:i:s'); }