DateFormat

DateFormat

is an option that determines the date formatting of dates.

Details

  • DateFormat indicates how a date should be displayed, including which elements appear and in what order.
  • DateFormat specifications may include which date elements appear, what language text is given in, the writing script used, and what date delimiters separate format elements.
  • Typical settings include:
  • Automaticdetermine date format automatically
    "format"named date format (e.g. "ISODateTime")
    {elem1,elem2,}ordered elements to be included
    assocAssociation of date format parameters
    localedefault parameters based on locale
  • The following parameters may be specified in DateFormatassoc specifications:
  • "Elements"Automaticdate string elements to include
    "Language"$Languagelanguage for text elements
    "WritingScript"Automaticwriting script for text elements
    "Delimiters"Automaticdelimiters to use between date elements
  • DateFormatlocale uses the default date formatting information specified by the given locale, including element ordering, language, writing script and delimiters. Locale specifications may be given using locale strings such as "en_US", "LanguageLocale" or "Language" entities.
  • "Language"lang specifications may be given using a language string (i.e. "Spanish"), ISO-639 language code (i.e. "es"), a "Language" Entity, or "LanguageLocale" Entity expression.
  • "WritingScript"script specifications may be given using a writing script string (i.e. "Latin"), ISO-15924 writing script code (i.e. "Latn") or a "WritingScript" Entity expression.
  • For DateFormat<|"Delimiters"delim|> specifications, if delim is a string, it will be inserted between each date element (i.e. {elem1,delim,elem2,delim,}), while a list of delimiters will be interwoven between the elements (i.e. {elem1,delim1,elem2,delim2,}).
  • DateFormat is set to $DateStringFormat by default.
  • DateFormat element specifications can be set to any format specification supported by DateString.
  • DateFormat controls the output formatting of DateObject, DateInterval and other date containers. For Interpreter it is used to indicate the input format associated with structured dates.

Examples

open allclose all

Basic Examples  (3)

Use long date format:

Specify your own format:

Use date formatting based on a given locale:

Use a format with a specific language and text elements:

Scope  (1)

When Automatic is given as a format specification, the granularity of the input will determine the format:

A format specification may be a named date format or a single date element:

An explicit list of date format elements may also be given:

DateFormat{elemi,} is equivalent to DateFormat<|"Elements"{elemi,}|>:

The language used by text elements in the date format may be specified using a "Language" Entity:

Some languages have multiple frequently used writing scripts, which can be differentiated with a "WritingScript" Entity:

When a single delimiter is given, it will be inserted between each date format element:

When a list of delimiters is given, they will be interspersed between the date format elements:

A locale may also be used as a format specification, which will use the appropriate elements, ordering, language, writing script and delimiters for the locale:

Wolfram Research (2014), DateFormat, Wolfram Language function, https://reference.wolfram.com/language/ref/DateFormat.html (updated 2021).

Text

Wolfram Research (2014), DateFormat, Wolfram Language function, https://reference.wolfram.com/language/ref/DateFormat.html (updated 2021).

CMS

Wolfram Language. 2014. "DateFormat." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/DateFormat.html.

APA

Wolfram Language. (2014). DateFormat. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DateFormat.html

BibTeX

@misc{reference.wolfram_2024_dateformat, author="Wolfram Research", title="{DateFormat}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/DateFormat.html}", note=[Accessed: 07-October-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_dateformat, organization={Wolfram Research}, title={DateFormat}, year={2021}, url={https://reference.wolfram.com/language/ref/DateFormat.html}, note=[Accessed: 07-October-2024 ]}