Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
-- stack repl --package <package-name>
-- stack repl --package time
> import Data.Time
Data.Time> getCurrentTime
2020-10-17 15:03:15.521782 UTC
Data.Time> utctDay <$> getCurrentTime
2020-10-17
Data.Time> today <- utctDay <$> getCurrentTime
Data.Time> today
2020-10-17
Data.Time> today0 = utctDay <$> getCurrentTime
Data.Time> today0
2020-10-17
Data.Time> toGregorian today
(2020,10,17)
Data.Time> parseTimeM True defaultTimeLocale "%Y-%m-%d" "2019-08-31" :: Maybe Day
Just 2019-08-31
Data.Time> parseTimeM True defaultTimeLocale "%Y-%m-%d" "asdf" :: Maybe Day
Nothing
Data.Time> addDays 3 today
2020-10-20
Data.Time> addGregorianMonthsClip 6 today
2021-04-17
Data.Time> addGregorianYearsClip 1 today
2021-10-17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment