Req #76622 [Com]: Support "quarter" keyword as relative format for DateTime

From: Date: Sun, 15 Jul 2018 07:51:51 +0000
Subject: Req #76622 [Com]: Support "quarter" keyword as relative format for DateTime
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216333@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76622&edit=1 ID: 76622 Comment by: a at b dot c dot de Reported by: thomas at landauer dot at Summary: Support "quarter" keyword as relative format for DateTime Status: Open Type: Feature/Change Request Package: Date/time related Operating System: Any PHP Version: Irrelevant Block user comment: N Private report: N New Comment: That would work (I'd be using "+ 3 months" and "+ 5 months"); the suggestion in the other bug you cite (#15184) for date('q') on the other hand would be useless for a year starting in June. It's the difference between "get a timestamp for a given quarter" and "get a quarter for a given timestamp". The former would actually be easier. Previous Comments: ------------------------------------------------------------------------ [2018-07-15 03:47:08] requinix@php.net For some, yes, but most of them I saw are based on the calendar year so chaining one or two relative amounts should get the job done. For example, US federal is one quarter behind the calendar; its Q1 2018 started Oct 1 2017 and you could get it with "quarter 1 2018 -3 months". ------------------------------------------------------------------------ [2018-07-15 03:37:50] a at b dot c dot de Although in some of those "other" cases you still need to know the month to make the right adjustment - and if you have that you can calculate the quarter anyway. ------------------------------------------------------------------------ [2018-07-15 02:39:54] requinix@php.net The problem is that there are multiple ways to define a quarter. Jan 1 - Mar 31 is what the (Gregorian) calendar says for the first quarter, but quarters are more commonly used in a fiscal sense and their definitions can vary wildly. https://en.wikipedia.org/wiki/Fiscal_year See also bug #15184, but it's been more than a decade so I think this is worth a second thought. Perhaps just going with the simple Gregorian version - which can often be used to derive others. ------------------------------------------------------------------------ [2018-07-14 17:02:38] thomas at landauer dot at Description: ------------ Considering the fact that \DateTime() does support some really exotic input (like e.g. "last sat of July 2008"), it would be nice to have some quarter-related formats too: * "first|last day of last|this|next quarter" Or maybe even: * "first|last day of quarter 4 2008" or "first|last day of fourth quarter 2008" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76622&edit=1

« previous php.bugs (#216333) next »