date_default_timezone_set() Not Working

This is a silly amateur hour error that Iโ€™m positive lots of people miss. datedefaulttimezone_set() needs to be called within functions, it isn’t a global function.

The script below will demonstrate the how datedefaulttimezone_set() affects date() (and time()).

Will output:

// Eastern
// Serverโ€˜s Time
// Central
// Eastern

Leave a Reply