|
|
set default timezone for date/time functions - PHP
|
Views : 1017
|
|
Tagged in : PHP
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
How to change the default timezone in PHP:
-- I have come across an issue that,
"I have converted GMT timestamp to UNIX timestamp using PHP mktime() and i got correct result in my localhost but when i uploaded that file into site, i got a different answer in my server.
For eg,
$tim = mktime(0,0,0,7,13,2009);
Result in local,
1247443200.
Result in server,
1247423400.
Searched for a while and finally found that the issue was in the timezone used in localhost and site. This is because server may use common timezone."
-- Inorder to set default timezone to the required timezone use, "date_default_timezone_set()".
For eg,
date_default_timezone_set(UTC);
$tim = mktime(0,0,0,7,13,2009);
Result in local,
-- Likewise, to get the default timezone use,"date_default_timezone_get()"
It will result the type of timezone which you have set to your system.
There are lot of timezones available in PHP.
|
|
By Ramya, On - 2009-08-06 |
|
|
|