Difference between revisions of "Getting the current date"

From HaskellWiki
Jump to navigation Jump to search
 
Line 1: Line 1:
 
to get the date just use
 
to get the date just use
 
<haskell>
 
<haskell>
  +
import Data.Time.Clock
  +
import Data.Time.Calendar
  +
 
date :: IO (Integer,Int,Int) -- :: (year,month,day)
 
date :: IO (Integer,Int,Int) -- :: (year,month,day)
 
date = getCurrentTime >>= return . toGregorian . utctDay
 
date = getCurrentTime >>= return . toGregorian . utctDay

Revision as of 13:53, 11 July 2007

to get the date just use

import Data.Time.Clock
import Data.Time.Calendar

date :: IO (Integer,Int,Int) -- :: (year,month,day)
date = getCurrentTime >>= return . toGregorian . utctDay