[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-beginners
Subject:    Re: [Haskell-beginners] get date
From:       Brandon S Allbery KF8NH <allbery () ece ! cmu ! edu>
Date:       2010-06-24 14:08:50
Message-ID: 4C2366F2.3060907 () ece ! cmu ! edu
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 6/24/10 03:52 , Luca Ciciriello 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 
> 
> currentTimeStr :: IO Day -> String

You can't escape from IO, but you can lift a formatter into IO.  Formatters
are in Data.Time.Format; look at the documentation for your system's
strftime() function to see how it works.

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery@ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwjZuIACgkQIn7hlCsL25UwpgCfRuhCW5sB9G8Ud9Ci3JUZbVTt
vAIAn3CFOoX9Q4etASv3ggC8KFxm94W6
=ZUFJ
-----END PGP SIGNATURE-----
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic