Renamed to ryan-haskell/date-format. It is published under that name, and new versions come out there.
Versions published as ryannhg/date-format still install under that name. 6 versions of 6 come from the new location (see their notes).
Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/ryan-haskell/date-format.
What we checked: The repo moved to github.com/ryan-haskell/date-format. Rebuilt with git archive from commit 95dd0ed20827 of https://github.com/ryan-haskell/date-format (zip prefix ryannhg-date-format-481d7e6/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 24a5fd5f367e237124e417471e25c8955a1a19ee.
The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.
Details · package.elm-lang.org's zip: https://github.com/ryannhg/date-format/zipball/2.0.1/
A reliable way to format dates and times with Elm.
If our users don't speak English, printing out "Monday" or "Tuesday" might not be a great fit.
Thanks to a great recommendation, date-format now supports multilingual output!
All you need to do is provide your own options, and format will use your preferences instead:
For a complete example, check out the FormatWithOptions.elm in the examples folder.
These are the available tokens to help you format dates.
Get the numeric value of the month.
Examples: 1, 2, 3, ... 11, 12
Get the numeric value of the month, with a suffix at the end.
Examples: 1st, 2nd, 3rd, ... 11th, 12th
Get the numeric value of the month, fixed to two places.
Examples: 01, 02, 03, ... 11, 12
Get the name of the month, but abbreviated (abbreviation function comes from the language settings)
Examples: Jan, Feb, Mar, ... Nov, Dec
Get the full name of the month.
Examples: January, February, ... December
Get the numeric value of the day of the month.
Examples: 1, 2, 3, ... 30, 31
Get the numeric value of the day of the month, with a suffix at the end.
Examples: 1st, 2nd, 3rd, ... 30th, 31st
Get the numeric value of the day of the month, fixed to two places.
Examples: 01, 02, 03, ... 30, 31
Get the numeric value of the day of the year.
Examples: 1, 2, 3, ... 364, 365
Get the numeric value of the day of the year, with a suffix at the end.
Examples: 1st, 2nd, 3rd, ... 364th, 365th
Get the numeric value of the day of the year, fixed to three places.
Examples: 001, 002, 003, ... 364, 365
Get the numeric value of the day of the week.
Examples: 0, 1, 2, ... 5, 6
Get the numeric value of the day of the week, with a suffix at the end.
Examples: 0th, 1st, 2nd, ... 5th, 6th
Gets the name of the day of the week, but just the first two letters.
Examples: Su, Mo, Tu, ... Fr, Sa
Gets the full name of the day of the week.
Examples: Sunday, Monday, ... Friday, Saturday
Get the year, but just the last two letters.
Examples: 70, 71, ... 29, 30
Get the year.
Examples: 1970, 1971, ... 2018, ... 9999, ...
Get the numeric value for the quarter of the year.
Examples: 1, 2, 3, 4
Get the numeric value for the quarter of the year, with a suffix.
Examples: 1st, 2nd, 3rd, 4th
Get the numeric value for the week of the year.
Examples: 1, 2, 3, ... 51, 52
Get the numeric value for the week of the year, with a suffix at the end.
Examples: 1st, 2nd, 3rd, ... 51st, 52nd
Get the numeric value for the week of the year, fixed to two places.
Examples: 01, 02, 03, ... 51, 52
Get the AM / PM value of the hour, in uppercase.
Examples: AM, PM
Get the AM / PM value of the hour, in uppercase.
Examples: am, pm
Get the hour of the 24-hour day.
Examples: 0, 1, 2, ... 22, 23
Get the hour of the 24-hour day, fixed to two places.
Examples: 00, 01, 02, ... 22, 23
Get the hour of the 12-hour day.
Examples: 0, 1, 2, ... 11, 12
Get the hour of the 12-hour day, fixed to two places.
Examples: 00, 01, 02, ... 11, 12
Get the hour of the 24-hour day, starting from one.
Examples: 1, 2, ... 23, 24
Get the hour of the 24-hour day, starting from one, fixed to two places.
Examples: 01, 02, ... 23, 24
Get the minute of the hour.
Examples: 0, 1, 2, ... 58, 59
Get the minute of the hour, fixed to two places.
Examples: 00, 01, 02, ... 58, 59
Get the second of the minute.
Examples: 0, 1, 2, ... 58, 59
Get the second of the minute, fixed to two places.
Examples: 00, 01, 02, ... 58, 59
Get the milliseconds of the second.
Examples: 0, 1, 2, ... 998, 999
Get the milliseconds of the second, fixed to three places.
Examples: 000, 001, 002, ... 998, 999
This function takes in a list of tokens,
Zone, andPosixto create your formatted string!Let's say
ourPosixValueis November 15, 1993 at 15:06.