Skip to content

Instantly share code, notes, and snippets.

@nobsun
Created February 20, 2014 01:05
Show Gist options
  • Save nobsun/9104940 to your computer and use it in GitHub Desktop.
Save nobsun/9104940 to your computer and use it in GitHub Desktop.
今日の日付をISO 8601形式で表示する ref: http://qiita.com/nobsun/items/a01b96cbf5775f7959b7
module Main where
import Control.Applicative
import Data.Time
import Data.Time.Calendar.OrdinalDate
import Data.Time.Calendar.WeekDate
import System.Environment
main :: IO ()
main = dispatch =<< getProgName
dispatch :: String -> IO ()
dispatch "todayo" = today showOrdinalDate
dispatch "todayw" = today showWeekDate
dispatch _ = today showGregorian
today :: (Day -> String) -> IO ()
today showDate = putStrLn . showDate . localDay
=<< (utcToLocalTime <$> getCurrentTimeZone <*> getCurrentTime)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment