tags:

views:

184

answers:

2

Is there a function in haskell that will allow me to enter component of a date (like a string representation or day month year components) that I can get information from (like day of week, days in a month, etc.)?

I've looked online and it looks like there are a lot of custom libraries, but I'm hoping there's one in the standard prelude library of ghci 10.6.4 that's just not well documented?

Thanks for any information :)

+2  A: 

A quick Google search turns up this, which may be what you want. It lets you parse strings representing dates and extract information from them.

avpx
I was hoping for something in the standard library so I wouldn't have to insure the end user would have spesific external libraries :)
Fry
What kind of end user do you have? a Haskell library isn't something like python/perl/ruby very late binding soo if you compile your code you should a one solid a.out
Jonke
+2  A: 

Are Data.Time.Calendar and Data.Time.Format in the time library sufficient?

You can parse a string representation of a date and get the length of a month using gregorianMonthLength. Not sure about day of the week, though you could format the date as a string using a format that just displays the week day.

Dan Dyer
I'd seen the Calendar, but I think I'd not looked into the format which seems to have most of the information that I'd need :) Thanks!
Fry
Kevin Won