Req #45483 [Opn->Wfx]: Add an era designater to DateTime methods when formatting or parsing dates

From: Date: Wed, 29 Sep 2021 16:24:06 +0000
Subject: Req #45483 [Opn->Wfx]: Add an era designater to DateTime methods when formatting or parsing dates
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236926@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=45483&edit=1 ID: 45483 Updated by: cmb@php.net Reported by: tj at systisoft dot com Summary: Add an era designater to DateTime methods when formatting or parsing dates -Status: Open +Status: Wont fix Type: Feature/Change Request Package: Date/time related Operating System: All PHP Version: 5.3CVS-2008-07-11 (CVS) -Assigned To: +Assigned To: derick Block user comment: N Private report: N New Comment: Most details of the date extension, such as leap years and seconds, timezones, DST, do not apply to the the proleptic calendar anyway, and ISO 8061 states that "values in the range [0000] through [1582] shall only be used by mutual agreement of the partners in information interchange". I suggest to use the calendar extensions for such dates (a parser might be implemented by a simple sscanf() or preg_match()). Therefore I'm closing this as WONTFIX. Derick might disagree; please re-open in that case. Previous Comments: ------------------------------------------------------------------------ [2008-07-17 08:50:44] tj at systisoft dot com On further thinking there should be a new format char for BC dates because Y formats the date with year 0 which is conforming with ISO8601. But years in the proleptic Gregorian calendar do not have a year 0. The year 0 in ISO8601 is 1 BC in the proleptic Gregorian calendar. ------------------------------------------------------------------------ [2008-07-15 11:47:34] tj at systisoft dot com There should also be a possibility to format a year without the sign, because if you format with 'Y' you will get something like: -2000 BC This can either be done by an new format char for unsigned year or that the 'Y' format is omitting the sign when a format char for the era designator is present. ------------------------------------------------------------------------ [2008-07-11 10:18:11] tj at systisoft dot com Description: ------------ It is currently not possible to specify an era designator in a format when parsing or formatting dates with DateTime::createFromFormat or DateTime::format. An era designater would be BC or AD as in 1/1/0200 BC or 1/1/2004 AD. I don't know which format char would be good since 'G' which is used in some other format patterns as era designator seems to be already taken. Reproduce code: --------------- N/A Expected result: ---------------- N/A Actual result: -------------- N/A ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=45483&edit=1

« previous php.bugs (#236926) next »