Ninjakreborn Posted January 12, 2010 Share Posted January 12, 2010 I am setting up a timestamp on a report for a client I built awhile back. I have quite a bit of experience messing with PHP dates, but never really had this issue. The timezone is set to GMT right now..I need it to default to EST and show EST time. $date = date('l jS \of F Y h:i:s A'); $csv .= $date .', '; echo '<p>Time: '.$date.'</p>'; There, that shows the time. It was in GMT format..so I did some steps to try and change it. I tried: putenv("EST"); Afterwards I tried setting an INI file in the folder above it and set that to: date.timezone = "EST" It's still printing the time as... Time: Tuesday 12th of January 2010 06:46:42 PM When EST time would be my time (1:53 P.M.) Edit: I am using, PHP Version 4.4.4. That might be part of the issue...since I can't use that new function which allows you to set the default time. Edit Part 2: Based off of my research, date_default_timezone_set('EST'); would work if I had PHP 5. Unfortunately I don't. Link to comment https://forums.phpfreaks.com/topic/188237-datetime-timezone-not-being-read/ Share on other sites More sharing options...
Genesis730 Posted January 12, 2010 Share Posted January 12, 2010 Try this to see if it's changing the time and if so, delete the GMT time =] echo "GMT Time: ". date("l jS \of F Y H:i:s A")."\n"; putenv("TZ=US/Eastern"); echo "Eastern Time: ". date("l jS \of F Y H:i:s A")."\n"; Link to comment https://forums.phpfreaks.com/topic/188237-datetime-timezone-not-being-read/#findComment-993756 Share on other sites More sharing options...
The Little Guy Posted January 12, 2010 Share Posted January 12, 2010 you can do it like this to set your ini file: http://beta.phpsnips.com/snippet.php?id=51 or if you have access to the ini file, just change it in there. then, here is a list of timezones that you can use: http://us.php.net/manual/en/timezones.php Link to comment https://forums.phpfreaks.com/topic/188237-datetime-timezone-not-being-read/#findComment-993760 Share on other sites More sharing options...
Ninjakreborn Posted January 12, 2010 Author Share Posted January 12, 2010 I tried INI, wasn't working. Genesis, thanks. It worked. Based off the documentation "EST" was a setting you could use. They need to update that, your setting worked. Thanks again. Link to comment https://forums.phpfreaks.com/topic/188237-datetime-timezone-not-being-read/#findComment-993761 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.