Req #15184 [Com]: Calculate the quarter with date('Q')?
| From: | programming at stefan-koch dot name | Date: | Thu, 18 Apr 2013 16:07:03 +0000 |
| Subject: | Req #15184 [Com]: Calculate the quarter with date('Q')? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-178524@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=15184&edit=1
ID: 15184
Comment by: programming at stefan-koch dot name
Reported by: j-f at gmx dot net
Summary: Calculate the quarter with date('Q')?
Status: Wont fix
Type: Feature/Change Request
Package: Feature/Change Request
Operating System: -
PHP Version: 4.1.1
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
I really cannot see from where you derive that "most people start Q1 in the first week of the
year or something". Whereever I look after a Google search, the definition of the quarters is:
First quarter: from the beginning of January to the end of March
Second quarter: from the beginning of April to the end of June
Third quarter: from the beginning of July to the end of September
Fourth quarter: from the beginning of October to the end of December
German Wikipedia lists it even clearer, should also be understandable to English speaking people:
http://de.wikipedia.org/wiki/Quartal#Quartale_und_ihre_Monate
e.g. Quarter I from 1. January to 31. March.
I already submitted a patch in another feature request [1], but judging from PHP's behaviour, I
am pretty sure that nobody will ever implement it (I would understand that MY implementation is not
good enough to be copied).
I want to mention that PHP dev's argumentation as I see it in many bug reports really keeps me
from diving into PHP interpreter development.
[1] https://bugs.php.net/bug.php?id=34932
Previous Comments:
------------------------------------------------------------------------
[2011-02-21 21:18:27] fernandojmartin at gmail dot com
Why not to just follow the way MySQL behaves?
In that way I'm not obligated to calculate part of the date OUTSIDE the DB server!
The YEAR starts on Jan 1st. Period.
The first week of the year has nothing to do with Q1 if the real date is December
31.
I don't see a clear sustenance in derick's explanation.
------------------------------------------------------------------------
[2005-08-12 08:46:49] derick@php.net
Some people have different opinions on when the quarter starts. Just saying that it starts at
january 1 is in correct, as most people start Q1 in the first week of the year or something.
That's why I don't think we should add this.
------------------------------------------------------------------------
[2005-08-11 19:22:39] nlopess@php.net
One more for you, Derick :)
------------------------------------------------------------------------
[2002-01-23 11:44:26] j-f at gmx dot net
I added a note how to calculate the quarter:
ceil(date('n')/3);
But I suggest extending date() with the option 'Q' or 'q'.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=15184&edit=1