RosettaCodeData/Task/System-time/Haskell/system-time-1.hs

12 lines
308 B
Haskell
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
import System.Time
(getClockTime, toCalendarTime, formatCalendarTime)
import System.Locale (defaultTimeLocale)
main :: IO ()
main = do
ct <- getClockTime
print ct -- print default format, or
cal <- toCalendarTime ct
putStrLn $ formatCalendarTime defaultTimeLocale "%a %b %e %H:%M:%S %Y" cal