Req #15184 [Com]: Calculate the quarter with date('Q')?
| From: | love at sickpeople dot se | Date: | Thu, 15 Nov 2018 15:46:37 +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-217976@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: love at sickpeople dot se
Reported by: j-f at gmx dot net
Summary: Calculate the quarter with date('Q')?
Status: Wont fix
Type: Feature/Change Request
Package: *General Issues
Operating System: -
PHP Version: 4.1.1
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
@requinix: could you please change the status from Wont fix to Open again?
Previous Comments:
------------------------------------------------------------------------
[2018-10-13 02:39:14] requinix@php.net
If coreutils/date has it then I think it's worth reconsidering - GNU has already decided what a
quarter is and PHP would merely be consistent with that, like it already is when it comes to other
date handling problems.
------------------------------------------------------------------------
[2018-10-13 01:39:06] love at sickpeople dot se
GNU coreutils added support for %q in 2016. See https://savannah.gnu.org/forum/forum.php?forum_id=8745
The value is 1 - 4.
------------------------------------------------------------------------
[2018-07-15 02:39:55] requinix@php.net
Related To: Bug #76622
------------------------------------------------------------------------
[2018-04-23 12:10:18] vickron at yahoo dot com
if cannot implement date('q')
at least should implemented strtotime('first day of quarter') ...
its annoying using some interpreted code just to wrap around this...
ceil(date('n')/3) just return the quarter number...
need to calc month 1 to 1-january 2-april 3-july and 4-october
using first_month_of_quarter = ceil(date('n')/3) * 3 -2;
date('Y-m-d', mktime (0,0,0,ceil(date('n')/3) * 3 -2,1,date('Y')));
------------------------------------------------------------------------
[2013-04-18 16:07:03] programming at stefan-koch dot name
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
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=15184
--
Edit this bug report at https://bugs.php.net/bug.php?id=15184&edit=1