getting Date.now() in elm.

965 views
Skip to first unread message

David Acevedo

unread,
Apr 18, 2016, 6:14:36 PM4/18/16
to Elm Discuss
Hi, Is there a way to get the Date now in Elm?

Max Goldstein

unread,
Apr 18, 2016, 6:48:59 PM4/18/16
to Elm Discuss
Date.now() is tricky because it's not a stateless function. It can change every time you call it (with no args).

I can point you to the Time docs, which include a way of getting the current time updated periodically, and the Date docs, which can convert from a Time. But if you're new to Elm, this might seem like a lot of complexity. (It's not in total, but it's a lot up front.)

Janis Voigtländer

unread,
Apr 19, 2016, 1:12:15 AM4/19/16
to elm-d...@googlegroups.com

2016-04-19 0:14 GMT+02:00 David Acevedo <rabbit...@gmail.com>:
Hi, Is there a way to get the Date now in Elm?

--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon

unread,
Apr 21, 2016, 12:58:50 AM4/21/16
to Elm Discuss
Evan mentioned in a similar thread that a task `Time.now` will come in 0.17.  I, for one, can't wait
Reply all
Reply to author
Forward
0 new messages