[Haskell-beginners] get date
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
Just use that.
> currentTimeStr :: IO Day -> String
Getting out of IO? I would think again. Following might be what you really
currentTimeStr :: IO Day -> IO String
> Any Idea?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners