[Haskell-beginners] get date
Luca Ciciriello
luca_ciciriello at hotmail.com
Thu Jun 24 04:17:32 EDT 2010
Starting from the beginning, my original problem is to create the string:
"File creation date: " ++ currentSystemDate ++ " by MyCompany"
to obtain the string
"File creation date: 2010-06-24 by MyCompany"
Probably this is really trivial, but I'm a real beginner in Haskell and this seems to me a big problem.
Luca.
On Jun 24, 2010, at 9:59 AM, Ozgur Akgun wrote:
> 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/02301868/attachment.html
More information about the Beginners
mailing list