php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43959 DateTimeZone gets exception with HST10HDT timezone
Submitted: 2008-01-29 04:14 UTC Modified: 2008-01-29 07:26 UTC
From: hughmcl at hotmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.5 OS: CentOS 5.1
Private report: No CVE-ID: None
 [2008-01-29 04:14 UTC] hughmcl at hotmail dot com
Description:
------------
We were using part of the code below to work out time zone differences, however when HST10HDT was entered it was giving an exception, even although it's a valid timezone.

Reproduce code:
---------------
<?
  try {
    #DateTimeZone Object for TimeZone for this phone
    $tz = 'HST10HDT';
    $cdto = new DateTimeZone($tz);
} catch(Exception $e) {
   print "Exception!\n";
   print " ---> ".$e->getMessage()."\n";
   exit;
}

print "No Exception!\n";

?>


Expected result:
----------------
No Exception!

Actual result:
--------------
Exception!
 ---> DateTimeZone::__construct(): Unknown or bad timezone (HST10HDT)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-29 07:26 UTC] derick@php.net
HST10HDT is not a valid zone, thus you get an error here. A list of valid zones is at http://php.net/timezones
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Dec 24 12:00:02 2025 UTC