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

%d bloggers like this: