|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #61841 date_default_timezone_set
Submitted: 2012-04-24 18:00 UTC Modified: 2012-04-25 05:09 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: l_x_young at hotmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID:
 [2012-04-24 18:00 UTC] l_x_young at hotmail dot com
From manual page:

The manual says that you can supply the UTC for the timezone_identifier. This is not true. The function will not accept a UTC. 

Here is an example error message:
Notice: date_default_timezone_set() []: Timezone ID '(UTC-12:00)' is invalid 

Test script:
$timeZone = "(UTC-12:00)";

// validate the timezone specified by the user
$script_tz = date_default_timezone_get();
if ( !date_default_timezone_set($timeZone) )
	trigger_error("Timezone is invalid.", E_USER_ERROR);

Expected result:
I would like this function to accept a UTC for the timezone_identifier parameter.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-24 18:02 UTC] l_x_young at hotmail dot com
I also tried "UTC-12:00", this doesn't work either.
 [2012-04-25 05:09 UTC]
Why not try 'UTC' like the manual page says?

"The timezone identifier, like *UTC* or *Europe/Lisbon*. The list of valid 
identifiers is available in the List of Supported Timezones."
 [2012-04-25 05:09 UTC]
-Status: Open +Status: Not a bug
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sat Nov 28 13:01:32 2015 UTC