enkidatron / elm-cldr / Cldr.Format.DateTime

DateTime Formatting

format : FormatType -> Internal.Locale.Locale -> Time.Zone -> Time.Posix -> String

Format a Time.Posix value, using the format for a specified FormatType, Locale, and Time.Zone

import Time
import Cldr.Locale exposing (en)

format short en Time.utc (Time.millisToPosix 959829796738)
--> "6/1/00, 3:23 AM"

Format Type


type FormatType
    = DateOnly Cldr.Format.Length.Length
    | TimeOnly Cldr.Format.Length.Length
    | DateAndTime ({ date : Cldr.Format.Length.Length, time : Cldr.Format.Length.Length })
    | WithOptions Cldr.Format.Options.DateTimeOptions

The different combinations of date and time that can be formatted.

short : FormatType

Use Short for both date and time

medium : FormatType

Use Medium for both date and time

long : FormatType

Use Long for both date and time

full : FormatType

Use Full for both date and time