Pretty much this. It’s possible the database server and web server are in different timezones. If you’re connecting to mysql to get the time from the database server, you’re better off just manually setting the correct timezone for a DateTime object. e.g. from the manual:
$date = new DateTime();
$date->setTimezone(new DateTimeZone('Pacific/Chatham'));
echo $date->format('d/m/Y H:i:s');
Thanks TomB /DaveMaxwell
I should explain a bit more. I’m only using a local testing server. The code I am developing will use curdate() to record any user interaction with the database and the CMS I’m hoping to build will query that date in many ways…e.g.
$result = $pdo->query('SELECT id, userdate FROM users
WHERE userdate >= CURDATE() - INTERVAL DAYOFMONTH(CURDATE()) DAY’);}
So essentially I’m looking to output (in my own testing environment) the value of that clause in bold above. Just to see if its evaluating to what I hope it will.