Reputation: 11241
Is there a good library for parsing dates from a string in Haskell or ANSI C? Something like PHP's strtotime, or Ruby's Time.parse or Chronic, or whatever.
If it can parse "next week", etc, then that's ideal, but even if it can just figure out for itself what format a complete date string is in and return the result, that would be good enough.
I'd really rather not port Chronic or extract strototime by hand...
Upvotes: 5
Views: 465
Reputation: 11241
After much hunting, I discovered that the date code in Git is pretty good and not very dependent on the rest of Git, so I pulled it out and made http://hackage.haskell.org/package/git-date
I'm willing to use a better solution if there is one :)
Upvotes: 6
Reputation: 3246
It doesn't handle "next week" style stuff, but the Data.Time.Format module from the time library does essentially what you want, I think, and it's included by default with the Haskell Platform. Just scroll down the haddock docs until you get to the parsing section.
Upvotes: 1