Created
October 18, 2020 20:25
-
-
Save gustavofranke/907dc30af2ba05d92ba1468d19435d09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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