CDateTimeParser and CDateFormatter: different syntax for 24h hours

So, I’d very much like to parse and format times with the same pattern, however, I think there might be a problem.

The function CDateFormatter->format() accepts a capital ‘H’ mask for 24h hours, whereas CDateTimeParser::parse() will result in false if parsing for a date with ‘H’ in it.

for example,

$timePattern=‘dd.MM.yyyy HH:mm’;



will result in boolean false in $timestamp.

$timestamp=CDateTimeParser::parse($date,‘dd.MM.yyyy hh:mm’);

will work good even with 24h timestamps, so there’s nothing wrong with the parsing, except its inability to recognize ‘H’.

This effectively means that as I want to format 24h timestamps, I’ll have to have two parse masks, one for parsing and one for formatting.

Or am I just missing something? I am using Yii version 1.0.7.