Req #54117 [Opn->Wfx]: Parameter 'z' false
| From: | danielc@php.net | Date: | Mon, 21 Nov 2011 02:59:48 +0000 |
| Subject: | Req #54117 [Opn->Wfx]: Parameter 'z' false | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165388@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54117&edit=1
ID: 54117
Updated by: danielc@php.net
Reported by: a dot borngesser at berlin dot de
Summary: Parameter 'z' false
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Date/time related
Operating System: Irrelevant
PHP Version: Irrelevant
-Assigned To:
+Assigned To: danielc
Block user comment: N
Private report: N
New Comment:
It is impossible to change the behavior of an existing format parameter due to the current behavior
being relied on by existing users. If you like, you may open a feature request for a new format
parameter, but this does not seem like an important feature since using z + 1 is a simple
workaround.
Previous Comments:
------------------------------------------------------------------------
[2011-03-16 09:42:49] a dot borngesser at berlin dot de
Is someone working on this issue or shut I open a new thread (and of course in english this time)?
------------------------------------------------------------------------
[2011-02-28 11:29:03] a dot borngesser at berlin dot de
Sorry, my text now in english.
The parameter 'z' is false from its basic set-up.
The first day of the year is '1' not '0'.
I know, that the count starts with 0, but it would be better to change the code of the parameter,
than to leave it to the programmers.
(I had some cases where it was used simply as is. The results where simply false, and when using it
in a very basic way by just displaying it, you don't think of a mistake.)
If a parameter is for returning the "incremented day of the year", it should do exactly
this, and not the "incremented day of the year -1".
------------------------------------------------------------------------
[2011-02-28 11:11:34] pajoye@php.net
Please report your bug in English.
------------------------------------------------------------------------
[2011-02-28 11:10:18] a dot borngesser at berlin dot de
Description:
------------
---
From manual page: http://www.php.net/function.date#Parameter-Liste
---
Parameter ist im Grundaufbau falsch.
"z Der Tag des Jahres (von 0 beginnend) 0 bis365"
=============== =
Der erste Tag des Jahres ist nicht '0' sondern '1'!
Natürlich ist es normal, das von 0 die Zählung beginnt, aber man sollte evtl. bei einem
Parameter dies intern gleich um +1 hochzählen und nicht den Programmierern überlassen.
Ich habe jetzt schon mehrere Fälle gehabt, wo der Parameter direkt genutzt wurde, was dann zu
falschen Ergebnissen geführt hat.
Wenn ein Parameter den hochgezählten Tag des Jahres angeben soll, sollte dies auch so sein und
nicht 'der hochgezählte Tag des Jahres -1'.
Test script:
---------------
echo "Der 1.1. 2010 hatte die LOS#: ".date ("z",mktime(0,0,0,1,1,2010));
Expected result:
----------------
Der 1.1. 2010 hatte die LOS#: 1
Actual result:
--------------
Der 1.1. 2010 hatte die LOS#: 0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54117&edit=1