php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #78835 Ambiguous definition of format character
Submitted: 2019-11-18 23:36 UTC Modified: 2019-12-08 15:22 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: filipbengtsson at live dot se Assigned: cmb (profile)
Status: Closed Package: Date/time related
PHP Version: 7.1.33 OS: Windows 7
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: filipbengtsson at live dot se
New email:
PHP Version: OS:

 

 [2019-11-18 23:36 UTC] filipbengtsson at live dot se
Description:
------------
---
From manual page: https://php.net/function.date
---
The manual page says that the format character O (capital letter o) represents "difference to Greenwich time (GMT) in hours", but the example says +0200, which I would describe as is 100 times greater than the time difference (and what it, after some testing, seems to actually do). It could also be interpreted as GMT offset by 200 hours (little over a week).

The bigger mystery is what the two trailing zeros do. I asumed they represent centiminutes (going from 00-99) since the documentation doesn't say anything about minutes. By running the following script, they turned out to be minutes (00-59).


Test script:
---------------
<?php
// Set timezone to UTC-03:30
date_default_timezone_set("America/St_Johns");
echo date("O");
?>


Expected result:
----------------
-0350

Actual result:
--------------
-0330

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-12-08 15:21 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=348466
Log: Fix #78835: Ambiguous definition of format character
 [2019-12-08 15:22 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2019-12-08 15:25 UTC] salathe@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=8374625569cf0f6f58f148d5b4dcd4bb7a6fbadd
Log: Fix #78835: Ambiguous definition of format character
 [2019-12-09 00:01 UTC] mumumu@php.net
Automatic comment from SVN on behalf of mumumu
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=348471
Log: Fix #78835: Ambiguous definition of format character

Bug: https://bugs.php.net/78835 (Open) Ambiguous definition of format character
 [2020-02-07 06:04 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=06e35bddfe37b923d88fa97a33bcb077cc539191
Log: Fix #78835: Ambiguous definition of format character
 [2020-12-30 11:59 UTC] nikic@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=a56362b6fae3864d7f8cdda2e160fd34bf4afb4a
Log: Fix #78835: Ambiguous definition of format character
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 08 21:01:27 2024 UTC