Created
February 20, 2014 01:05
-
-
Save nobsun/9104940 to your computer and use it in GitHub Desktop.
今日の日付をISO 8601形式で表示する ref: http://qiita.com/nobsun/items/a01b96cbf5775f7959b7
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
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