In the date() function the formats are split up. In date() G is w/o leading zeros and H is w/ leading zeros.
Why were these (as well as many others) combined and turned into an either/or for DateTime::createFromFormat? On Wed, Aug 3, 2011 at 4:10 PM, Derick Rethans <der...@php.net> wrote: > On Wed, 3 Aug 2011, Nicolai Scheer wrote: > > > On 03.08.2011 21:29, Joey Smith wrote: > > >> 2011/8/4 Nicolai Scheer <sc...@planetavent.de>: > > >>> Hi! > > >>> > > >>> Did anyone had the time to review bug 55240 > > >>> (https://bugs.php.net/bug.php?id=55240), yet? > > >>> > > > > > > It definitely appears to be unexpected behaviour - the 'G' format for > > > hours is "24-hour format without leading zeroes" - so the expectation > > > would be that 'Gi' parses '800' as '8 hours and 0 minutes'. (Also, I > > > thought I would point out here that the comments on 'G' and 'H', in > > > timelib_parse_from_format are backwards here - same with 'g' and 'h'.) > > > > Unfortunately, there's nothing I could do about the strings to be parsed > > (in terms of customer agreement...). > > > > "24-hour format without leading zeroes" is exactly what I had expected > > from the 'G' format as well. "24-hour" somehow implies "not greater than > > 24". On the other hand "overflow" handling might be expected (and even a > > good thing to do?). > > > > Let's see what others are about to comment on the issue... > > Personally I'd vote for "fixing" this by limiting the parsed value. > > Another possibility would be to introduce a new format without the > > "overflow handling"... > > Yes, this needs fixing. I am not sure how easy this is though... > I've assigned the bug to myself. > > cheers, > Derick > > -- > http://derickrethans.nl | http://xdebug.org > Like Xdebug? Consider a donation: http://xdebug.org/donate.php > twitter: @derickr and @xdebug > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >