DatePattern

DatePattern[{"e1","e2",}]

represents the characters of a date with elements of type "ei" in StringExpression.

DatePattern[{"e1","e2",},sep]

allows separators that match the string expression sep.

Details

  • Possible element types "ei" are: "Year", "Quarter", "Month", "MonthName", "Day", "DayName", "Hour", "AMPM", "Minute", "Second".
  • If no explicit separator is specified, the "ei" must be separated by /, -, :, or . characters.

Examples

open allclose all

Basic Examples  (3)

Compare a string to a list of date elements:

Compare to a list of time elements:

Compare to a pattern with all separators explicitly given:

Scope  (2)

Date elements do not match out-of-range values:

Test a string allowing only "/" characters as separators:

Test the same string allowing only colon separators:

Applications  (1)

Define a function only for month, year strings:

The function returns unevaluated for other input patterns:

Properties & Relations  (1)

DateString gives results that match a date pattern:

Wolfram Research (2007), DatePattern, Wolfram Language function, https://reference.wolfram.com/language/ref/DatePattern.html.

Text

Wolfram Research (2007), DatePattern, Wolfram Language function, https://reference.wolfram.com/language/ref/DatePattern.html.

CMS

Wolfram Language. 2007. "DatePattern." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DatePattern.html.

APA

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

BibTeX

@misc{reference.wolfram_2024_datepattern, author="Wolfram Research", title="{DatePattern}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/DatePattern.html}", note=[Accessed: 30-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_datepattern, organization={Wolfram Research}, title={DatePattern}, year={2007}, url={https://reference.wolfram.com/language/ref/DatePattern.html}, note=[Accessed: 30-December-2024 ]}