Re: %p in DateTime::Format::Strptime doesn't match PM
On Tue, 20 Jun 2006, Rick Measham wrote: To work out the 'why', check $p-errmsg: Your am/pm value (PM) does not match your hour (01) So your am/pm value of 'PM' doesn't match the hour 01 as 01 is in the morning. To hand it to you on a platter, you're using the %H specifier in your pattern which is the 24-hour specifier rather than %I which is the 12 hour specifier. Oh my! Thanks for your help. But I've got to tell you, had I seen Your am/pm value (PM) does not match your hour (01), I would have never guessed what it meant. Maybe %H matched a 24-hour value in the AM range, which conflicts with the %p value found (PM). Use %I for 12-hour values. would be easier to understand for the impatient reader :). Thanks again, -- Mike Mike Schilli [EMAIL PROTECTED]
Re: %p in DateTime::Format::Strptime doesn't match PM
Mike Schilli wrote: Maybe %H matched a 24-hour value in the AM range, which conflicts with the %p value found (PM). Use %I for 12-hour values. would be easier to understand for the impatient reader :). Sure .. I can do that .. though it won't specify %H .. more like: The hour value is in 24-hour time, however the value specified (1) does not match the am/pm value (pm) -- Message protected by MailGuard: e-mail anti-virus, anti-spam and content filtering. http://www.mailguard.com.au
Re: %p in DateTime::Format::Strptime doesn't match PM
On Tue, 20 Jun 2006, Rick Measham wrote: Mike Schilli wrote: Maybe %H matched a 24-hour value in the AM range, which conflicts with the %p value found (PM). Use %I for 12-hour values. would be easier to understand for the impatient reader :). Sure .. I can do that .. though it won't specify %H .. more like: The hour value is in 24-hour time, however the value specified (1) does not match the am/pm value (pm) Hmm, it's more expressive than the previous one, but I'd say that using %I instead of %H is not obvious (even for me, and I've been using your module for a while now), so I think the error message could benefit from having a hint to %I included. -- Mike Mike Schilli [EMAIL PROTECTED]
%p in DateTime::Format::Strptime doesn't match PM
Looks like the %p in the Strptime snippet below doesn't match the PM in the date string. Anyone knows why? use DateTime::Format::Strptime; my $p = DateTime::Format::Strptime-new( pattern = '%d/%b/%Y %H:%M %p', locale = 'en_US', ); my $dt = $p-parse_datetime(21/Jun/2006 01:30 PM); print $dt\n; -- Mike Mike Schilli [EMAIL PROTECTED]
Re: %p in DateTime::Format::Strptime doesn't match PM
Mike Schilli wrote: Looks like the %p in the Strptime snippet below doesn't match the PM in the date string. Anyone knows why? To work out the 'why', check $p-errmsg: Your am/pm value (PM) does not match your hour (01) So your am/pm value of 'PM' doesn't match the hour 01 as 01 is in the morning. To hand it to you on a platter, you're using the %H specifier in your pattern which is the 24-hour specifier rather than %I which is the 12 hour specifier. Cheers! Rick Measham -- Message protected by MailGuard: e-mail anti-virus, anti-spam and content filtering. http://www.mailguard.com.au