Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the closest thing to 'date_default_timezone_set' in PHP4?

Tags:

php

How can I achieve a similar effect to 'date_default_timezone_set' in PHP4? I need to use the date() function while taking into account local time zones and also day light saving.

Edit: example with putenv:

putenv('TZ=Australia/Victoria');    
echo date('l jS \of F Y h:i:s A');

Outputs

Thursday 6th of October 2011 07:36:49 PM

Actual time here in Victoria

Friday 7th October 2011 06:36:49 AM

like image 319
Chris Avatar asked Oct 09 '22 20:10

Chris


2 Answers

No solution came from this question. I ended up doing a manual work around using the Flash Player.

like image 149
Chris Avatar answered Oct 13 '22 10:10

Chris


It looks like the TZ environment variable is what you would need to use for this. Using putenv() you should be able to dynamically change the timezone.

like image 29
Jeff Day Avatar answered Oct 13 '22 11:10

Jeff Day