python72 Posted November 27, 2010 Share Posted November 27, 2010 I am trying to get local date/time. In my php file I am setting my timezone using $timezone = "America/Toronto"; putenv ('TZ=' . $timezone); Then I use the following to get current date and time print_r (getdate()); but my date displays in GMT, What am I doing wrong? As in the code above I am in Toronto and I need EST. Link to comment https://forums.phpfreaks.com/topic/219959-local-time-zone-in-php-4/ Share on other sites More sharing options...
trq Posted November 27, 2010 Share Posted November 27, 2010 Is there a particular reason your using php4 ? Link to comment https://forums.phpfreaks.com/topic/219959-local-time-zone-in-php-4/#findComment-1140181 Share on other sites More sharing options...
python72 Posted November 27, 2010 Author Share Posted November 27, 2010 That is what my hosting provider has, I have tried to use the date_default_timezone_set('America/Toronto'); but I get errors. Link to comment https://forums.phpfreaks.com/topic/219959-local-time-zone-in-php-4/#findComment-1140185 Share on other sites More sharing options...
trq Posted November 27, 2010 Share Posted November 27, 2010 date_default_timezone_set requires php5. Link to comment https://forums.phpfreaks.com/topic/219959-local-time-zone-in-php-4/#findComment-1140188 Share on other sites More sharing options...
python72 Posted November 27, 2010 Author Share Posted November 27, 2010 That is why I am trying to use the putenv But don't know what I am doing wrong Link to comment https://forums.phpfreaks.com/topic/219959-local-time-zone-in-php-4/#findComment-1140190 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.