$dt = new DateTime(); $result = $dt->format('Y-m-d H:i:s');
This gives the correct date, but the wrong time. The time at datetime in the computer is correct. Where should I be looking to correct this, please ?
Timezones
http://php.net/manual/en/timezones.php
You'll likely want to set the date.timezone value in your php.ini, but you can also set it on-the-fly via date_default_timezone_set().
Yes, This did it. Thank you.
You can also set it when you create the object, such as:
$date = new DateTime("now", new DateTimeZone("America/Denver")); $result = $date->format('Y-m-d H:i:s');