PHP returning wrong date

PHP returning wrong date

From time to time we are working on small campaigns, where competition starts at given time. Because in Australia we have “so many” timezones, it’s critical to set things correctly according to the time zone.

So firsting first let’s check server time zone:

date
Wed Dec 12 18:46:11 AEDT 2018

Unfortunately PHP turns something completely diffrerent:

$today = date('YmdHi');
var_dump($today);
string(12) "201812120746"

Date is a little bit offset. After digging out, PHP needs also timezone setup correctly, either in php.ini:

date.timezone =

Or using:

date_default_timezone_set('UTC');