tags:

views:

65

answers:

1

In Perl, why I get different results from parsedate(2010-7-2 13:0:0) and parsedate(2010-7-2 13:00:0) ?

+5  A: 

The 2010-7-2 13:0:0 string is not in a valid format, and is actually not being parsed at all (it appears) as evidenced by the fact that parsedate("2010-7-2") returns the same value as parsedate("2010-7-2 13:0:0") for me.

Based on the docs, it's simply parsing the YYYY-MM-DD, but not parsing the 13:0:0 at all because it is expecting it to be in HH:MM format and not HH:M format. Basically, you have to use two digits for the minutes in order for it to be valid input.

eldarerathis