Scott R. Godin wrote:
I'm sort of surprised that there is no equivalent DateTime-using module that would mirror the capabilities of Date::Parse. Dave, Have you talked with Graham Barr at all about merging the arbitrary-date-parsing capabilities (of Date::Parse) into the DateTime family tree?

G'day Scott,

It's been discussed before, and the main reason is below. There's just no way to properly parse a datetime. You can make 'best guesses'. But you should probably use something else to make your guesses, then offer them to the user to pick which they meant.

DateTime prides itself on being accurate and predictable and should never produce unexpected results.

That being said, there would certainly be room for a DateTime::Format::Guess module that took strings and attempted to guess what the string represented. Just be prepared for a lot of .. erm .. 'help' from this list describing the various preferences for guessing that would need to be included.

I think Graham has even mentioned something about it himself, though that could be complete tish.

[At one stage I was a fair way through a module that could get down to finding the date in text such as "She promised she'd be there by five past midday on the first Monday in April", until I realised that it was a fun exercise but not much use.]

Cheers!
Rick Measham

parse("04.05.12")

- May 4th, 1912
- May 4th, 2012
- April 5th, 1912
- April 5th, 2012
- May 12, 1904
- May 12, 2004
- 4:05:12 AM
- 16:05:12 (4:05:12 PM)


Reply via email to