Format time in elm with ease.
format : Time.Zone -> String -> Basics.Int -> String
Formats date from milliseconds based on a format string. Strings which will be substitued with correct time:
"Millis" "padMillis" "Second" "padSecond" "Minute" "padMinute" "Hour" "padHour" "Weekday" "Day" "padDay" "ordDay" "Month" "Year"
(example milliseconds can be obtained in js with:
new Date("1 Jan 2018").getTime()
// => 1514764800000
)
Examples: import Time exposing (utc) import Time.Format as Time
format = Time.format utc
format "Weekday, Day Month Year at Hour:Minute:Second and Millisms" 1514764800000 -- "Mon, 1 Jan 2018 at 0:0:0 and 0ms"
format "Weekday, padDay Month Year at padHour:padMinute:padSecond and padMillisms" 1514764800000 -- "Mon, 01 Jan 2018 at 00:00:00 and 000ms"
format "Weekday, ordDay Month Year at Hour:Minute:Second and Millisms" 1514764800000 -- "Mon, 1st Jan 2018 at 0:0:0 and 0ms"
monthToString : Time.Month -> String
monthToString returns Month as a String
Example: monthToString Jan -- "Jan"
weekdayToString : Time.Weekday -> String
weekdayToString returns Weekday as a String
Example: weekdayToString Mon -- "Mon"