Last active
August 29, 2015 13:57
-
-
Save rolios/9475191 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
import Data.Time.Clock | |
import Data.Time.Calendar | |
import Data.Time.Format | |
import System.Locale | |
currentDate :: IO (Integer, Int, Int) | |
currentDate = fmap (toGregorian . utctDay) getCurrentTime | |
daysOfMonth :: Integer -> Int -> [Day] | |
daysOfMonth year month = map (fromGregorian year month) [1..gregorianMonthLength year month] | |
formatDays :: [Day] -> [String] | |
formatDays = map (formatTime defaultTimeLocale "%A %d %B %Y") | |
main = do | |
(year, month, _) <- currentDate | |
let days = daysOfMonth year month | |
let daysFormatted = formatDays days | |
mapM_ print daysFormatted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment