[Haskell-cafe] Re: How to work with date?

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Mon Mar 2 06:22:55 EST 2009


Magicloud Magiclouds <magicloud.magiclouds at gmail.com> writes:

> Hi,
>   I am working on some calendar GUI thing. And I cannot find a library
> to operate the "date".
>   Like, when `now <- getZonedTime`, how could I get all the dates of
> the week. Or when I got `today`, how to get the date of 10 days ago?

This sort of thing (given now <- getZonedTime):

take 10 $ map (addDays (-1)) $ repeat $ utctDay $ zonedTimeToUTC now

there's enough functions in that to be going on with, I
think.

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html  (updated 2009-01-31)



More information about the Haskell-Cafe mailing list