I\'m running elm-repl to play around with the language.
I\'d like to see what the current time is. How would I do that? It doesn\'t appear to be possible with the c
You can use the Time package and/or the Date package.
Here's a contrived example which uses both:
import Signal
import Time exposing (every, second)
import Date exposing (year, hour, minute, second, fromTime)
import Graphics.Element exposing (show)
main =
Signal.map currentTime (Time.every Time.second)
currentTime t =
let date' = fromTime t
hour' = toString (Date.hour date')
minute' = toString (Date.minute date')
second' = toString (Date.second date')
year' = toString (year date')
now = "The current time is: " ++ hour' ++ ":" ++ minute' ++ ":" ++ second'
in
show now