php.net |  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
Votes:1
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: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: l_x_young at hotmail dot com
New email:
PHP Version: OS:

 

 [2012-04-24 18:00 UTC] l_x_young at hotmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.date-default-timezone-set#refsect1-function.date-default-timezone-set-parameters
---

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() [function.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) )
{
	date_default_timezone_set($script_tz);
	trigger_error("Timezone is invalid.", E_USER_ERROR);
}
date_default_timezone_set($script_tz);

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


Patches

Pull Requests

History

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] dtajchreber@php.net
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." 

http://codepad.org/YOBoEniH
 [2012-04-25 05:09 UTC] dtajchreber@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 02:01:32 2025 UTC