in reply to Re: Finding time difference from two strings
in thread Finding time difference from two strings

I checked the Date::Manip CPAN module but it doesn't have a way to set the format that it uses to parse dates. You could use a regular-expression to parse it out and then convert it to a format recognized by the ParseDate function in Date::Manip

Well... It's true that there is no format to feed ParseDate with, but that's actually more of a feature then a bug :)

ParseDate goes a long way to understand almost whatever way to express a date you choose - inclusive thinks like 'two weeks after Christmas' - and it does it quite well. I'm using it for years and have no complaint on it so far.

Give the parser a date string that someone else can understand, and it will get it right. Forget about regexes or any complication - express tha date in a meaningful way and it will 'just work'.

Krambambuli
---
enjoying Mark Jason Dominus' Higher-Order Perl
  • Comment on Re^2: Finding time difference from two strings

Replies are listed 'Best First'.
Re^3: Finding time difference from two strings
by omouse (Initiate) on Oct 27, 2007 at 20:17 UTC
    Ah I see. I was just skimming through the docs and I didn't realize it could do that. I thought it had to accept it in a certain form such as "YYYY-MM-DD" or "YYYY-MM". Thanks for clearing that up :D