php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33920 Wrong shows hour
Submitted: 2005-07-29 16:37 UTC Modified: 2005-07-30 00:33 UTC
From: php-work at yandex dot ru Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5CVS-2005-07-29 (dev) OS: Windows XP SP2
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: php-work at yandex dot ru
New email:
PHP Version: OS:

 

 [2005-07-29 16:37 UTC] php-work at yandex dot ru
Description:
------------
Code:
<?php
echo date("r"); 
?>
print Fri, 29 Jul 2005 14:22:56 +0000, but stated time zone: (GMT+03:00) Moscow. 

I tried to use other time zone, setlocale, but result is not changed.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-29 18:14 UTC] sniper@php.net
Set the timezone in php.ini using date.timezone setting.

 [2005-07-29 19:22 UTC] php-work at yandex dot ru
Tried, no effect.
 [2005-07-29 20:00 UTC] nlopess@php.net
Probably your TZ environment var is set to GMT.
So, you need to use the date_default_timezone_set() function to overide it.
 [2005-07-29 22:43 UTC] php-work at yandex dot ru
I has tried date_default_timezone_set('GMT'), but no result.
date_default_timezone_get return UTC. If add the date_default_timezone_set('GMT'), return GMT.
Script:
<?php
date_default_timezone_set('GMT');
echo date_default_timezone_get();
echo date('H');
?>
print GMT20 (but current time - 00:42).
 [2005-07-29 22:45 UTC] php-work at yandex dot ru
And else. I tried it (echo date('H');) on PHP5.0.4b3 and result is true, 00....
 [2005-07-29 22:48 UTC] php-work at yandex dot ru
Sorry, on PHP5.0.4
 [2005-07-30 00:33 UTC] sniper@php.net
You're supposed to set the timezone to whatever your timezone IS, not to GMT. Do NOT reopen this, there is no bug here.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jun 03 01:01:26 2025 UTC