[Haskell-beginners] get date

Ozgur Akgun ozgurakgun at gmail.com
Thu Jun 24 03:59:33 EDT 2010


On 24 June 2010 10:52, Luca Ciciriello <luca_ciciriello at hotmail.com> wrote:

> Just a question.
> How can I obtain a String from
>
> currentTime :: IO Day
> currentTime =  utctDay `fmap` getCurrentTime
>
> Here currentTime returns to me 2010-06-24, but I want "2010-06-24".
> In another worlds I need a function
>
>
I bet Day has a Show instance (that's why you get 2010-06-24 in ghci I
suppose)
Just use that.



> currentTimeStr :: IO Day -> String
>
>
Getting out of IO? I would think again. Following might be what you really
want:

currentTimeStr :: IO Day -> IO String



> Any Idea?
>
> Luca.
>

Best,
Ozgur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100624/94948a5f/attachment.html


More information about the Beginners mailing list