Skip to content

Instantly share code, notes, and snippets.

@rolios
Last active August 29, 2015 13:57
Show Gist options
  • Save rolios/9475191 to your computer and use it in GitHub Desktop.
Save rolios/9475191 to your computer and use it in GitHub Desktop.
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