[Haskell-cafe] date parsing and formatting

Alex Baranosky alexander.baranosky at gmail.com
Sat Nov 13 16:35:34 EST 2010

I've been working with Haskell's Date.Time modules to parse a date like
12-4-1999 or 1-31-1999. I tried:

parseDay :: String -> Day
parseDay s = readTime defaultTimeLocale "%m%d%Y" s

And I think it wants my months and days to have exactly two digits instead
of 1 or 2...

What's the proper way to do this?

Also, I'd like to print out my Day in this format: 12/4/1999 what's the
Haskell way to?

Thanks for the help.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101115/26ada03f/attachment.html

More information about the Haskell-Cafe mailing list