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.
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.
Examples
open all close allBasic Examples (3)
Compare a string to a list of date elements:
StringMatchQ["3/15/1984", DatePattern[{"Month", "Day", "Year"}]]Compare to a list of time elements:
StringMatchQ["00:38:16", DatePattern[{"Hour", "Minute", "Second"}]]Compare to a pattern with all separators explicitly given:
StringMatchQ["Wed, 15 Nov 2006", DatePattern[{"DayName", ", ", "Day", " ", "MonthName", " ", "Year"}]]Scope (2)
Date elements do not match out-of-range values:
StringMatchQ["3/15/1984", DatePattern[{"Day", "Month", "Year"}]]Test a string allowing only "/" characters as separators:
StringMatchQ["12/10/06", DatePattern[{"Year", "Month", "Day"}, "/"]]Test the same string allowing only colon separators:
StringMatchQ["12/10/06", DatePattern[{"Year", "Month", "Day"}, ":"]]Applications (1)
Properties & Relations (1)
DateString gives results that match a date pattern:
DateString[{"Hour", ":", "Minute"}]StringMatchQ[%, DatePattern[{"Hour", ":", "Minute"}]]See Also
Tech Notes
Related Guides
History
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_2026_datepattern, author="Wolfram Research", title="{DatePattern}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/DatePattern.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_datepattern, organization={Wolfram Research}, title={DatePattern}, year={2007}, url={https://reference.wolfram.com/language/ref/DatePattern.html}, note=[Accessed: 13-June-2026]}