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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC