Installed

elm/browser
1.0.2
elm/core
1.0.5
elm/html
1.0.0
elm/time
1.0.0

Registry

elm/http
2.0.0
elm/random
1.0.0
elm/file
1.0.5
elm/json
1.1.3
elm/svg
1.0.1
evancz/elm-playground
1.0.3
elm-explorations/webgl
1.1.3
w0rm/elm-physics
5.1.3
rtfeldman/elm-css
18.0.0
mdgriffith/elm-ui
1.1.8
​x
    hour   = String.fromInt (Time.toHour   model.zone model.time)
 
1
-- Show the current time in your time zone.
2
--
3
-- Read how it works:
4
--   https://guide.elm-lang.org/effects/time.html
5
--
6
-- For an analog clock, check out this SVG example:
7
--   https://elm-lang.org/examples/clock
8
--
9
​
10
import Browser
11
import Html exposing (..)
12
import Task
13
import Time
14
​
15
​
16
​
17
-- MAIN
18
​
19
​
20
main =
21
  Browser.element
22
    { init = init
23
    , view = view
24
    , update = update
25
    , subscriptions = subscriptions
26
    }
27
​
28
​
29
​
30
-- MODEL
31
​
32
​
33
type alias Model =
34
  { zone : Time.Zone
35
  , time : Time.Posix
36
  }
37
​
38
​
39
init : () -> (Model, Cmd Msg)
40
init _ =
41
  ( Model Time.utc (Time.millisToPosix 0)
42
  , Task.perform AdjustTimeZone Time.here
43
  )
44
​
45
​
46
​
47
-- UPDATE
48
​
49
​