Tutorial by Examples

Current date and time can be found with getCurrentTime: import Data.Time print =<< getCurrentTime -- 2016-08-02 12:05:08.937169 UTC Alternatively, just the date is returned by fromGregorian: fromGregorian 1984 11 17 -- yields a Day
Given a Day, we can perform simple arithmetic and comparisons, such as adding: import Data.Time addDays 1 (fromGregorian 2000 1 1) -- 2000-01-02 addDays 1 (fromGregorian 2000 12 31) -- 2001-01-01 Subtract: addDays (-1) (fromGregorian 2000 1 1) -- 1999-12-31 addDays (-1) (fromGregorian...

Page 1 of 1