
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. Alex

On Sat, Nov 13, 2010 at 4:35 PM, Alex Baranosky
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?
Something like this, perhaps, parseDate :: String -> LocalTime parseDate = readTime defaultTimeLocale "%m/%e/%Y" printDate :: LocalTime -> String printDate = formatTime defaultTimeLocale "%m/%-e/%Y" Anthony
participants (2)
-
Alex Baranosky
-
Anthony Cowley