DateList
Details and Options
- DateList[] uses whatever date and time have been set on your computer system. It performs no corrections for time zones, daylight saving time, etc.
- In DateList[date], the following date and time specifications can be given as date:
-
date DateObject specification {y,m,d,h,m,s} DateList specification time AbsoluteTime specification "string" DateString specification {"string",fmt} date string formed from the specified format - DateList[TimeZone->z] gives the date and time inferred for time zone z by assuming that your computer is set for the time zone specified by $TimeZone. »
- Shorter lists can be used in DateList[{y,m,…}]: {y} is equivalent to {y,1,1,0,0,0}, {y,m} to {y,m,1,0,0,0}, etc.
- Values of m, d, h, m, s outside their normal ranges are appropriately reduced. Noninteger values of d, h, m, s can also be used. »
- You can compare two lists returned by DateList using NumericalOrder. »
- In the form DateList[{"string",{"e1","e2",…}}], the "ei" can be "Year", "YearShort", "Quarter", "Month", "MonthName", "Day", "DayName", "Hour", "Hour12", "AMPM", "Minute", "Second", or "Millisecond".
- DateList[{"string",{"e1","e2",…}}] uses the "ei" to fill in elements of {y,m,d,h,m,s}. Those not filled in are taken to have default values {yc,1,1,0,0,0}, where yc is the current year. »
- In DateList[{"string",{"e1","e2",…}}], the "ei" are extracted from "string" in the order given, and can be separated by any non-alphanumeric characters. »
- DateList[{"string",{"e1","sep12","e2","sep23",…}}] extracts elements using the explicit separators specified. »
Examples
open all close allBasic Examples (2)
Scope (8)
Date lists are converted to standard normalized form:
DateList[DateObject[{2022, 3, 4, 12, 20, 9}, "Instant", "Gregorian", -5.]]Strings are automatically interpreted when possible:
DateList["2022-12-15"]DateList["10 March 2022"]Separators are assumed if not specified:
DateList[{"2/23/2022", {"Month", "Day", "Year"}}]DateList[{"2/23/2022", {"Month", "/", "Day", "/", "Year"}}]Day, hour, minute, and second values can be nonintegers:
DateList[{2022, 3, 15.5}]DateList[{2022, 3, 15, 12.3}]The current year is used if not specified in a string:
DateList[{"2/15", {"Month", "Day"}}]Convert an absolute time to a date list:
DateList[3855673600]DateList[{2022, 12}]Generalizations & Extensions (1)
Options (1)
Applications (1)
Properties & Relations (4)
DateObject represents a date specification:
DateObject[{2022, 1, 1}]AbsoluteTime represents dates as seconds since the beginning of 1900:
AbsoluteTime[%]DateList represents dates as lists of date elements:
DateList[%]DateString represents dates as strings:
DateString[%]Use DateListPlot to plot data with date list
coordinates:
DateListPlot[{{{2022, 1}, 2}, {{2022, 2}, 4}, {{2022, 3}, 6}, {{2022, 4}, 8}}]Use DatePlus to add time units to a date list:
DatePlus[DateObject[{2022, 1, 1}, "Day"], {3, "Day"}]Use DateDifference to find the number of time units between dates:
DateDifference[DateObject[{2022, 2, 1}, "Day"], DateObject[{2022, 5, 1}, "Day"]]Use NumericalOrder to determine the order of dates:
NumericalOrder[DateList[{2022, 1}], DateList[{2022, 5}]]NumericalOrder[DateList["2022 December 28"], DateList[{2022, 1}]]The canonicalization performed by DateList is significant:
Table[NumericalOrder[DateList[{2022, m}], DateList[{2023, 7}]], {m, 15, 25}]Table[NumericalOrder[{2022, m}, {2023, 7}], {m, 15, 25}]Possible Issues (2)
Tech Notes
Text
Wolfram Research (2007), DateList, Wolfram Language function, https://reference.wolfram.com/language/ref/DateList.html (updated 2014).
CMS
Wolfram Language. 2007. "DateList." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/DateList.html.
APA
Wolfram Language. (2007). DateList. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DateList.html
BibTeX
@misc{reference.wolfram_2026_datelist, author="Wolfram Research", title="{DateList}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/DateList.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_datelist, organization={Wolfram Research}, title={DateList}, year={2014}, url={https://reference.wolfram.com/language/ref/DateList.html}, note=[Accessed: 13-June-2026]}