DateSelect[list,crit]
picks out all dates datei of a list for which crit[datei] is True.
DateSelect[int,crit]
returns all dates within the DateInterval int for which crit[datei] is True.
DateSelect[crit]
represents an operator form of DateSelect that can be applied to an expression.
DateSelect
DateSelect[list,crit]
picks out all dates datei of a list for which crit[datei] is True.
DateSelect[int,crit]
returns all dates within the DateInterval int for which crit[datei] is True.
DateSelect[crit]
represents an operator form of DateSelect that can be applied to an expression.
Details
- DateSelect is typically used to filter out dates that satisfy a criterion, such as falling in a specific month or day of the week.
- In DateSelect[list,crit], crit is a Boolean expression, typically composed of date element tests, such as #Month==8 or #DayName==Monday.
- DateSelect supports all date elements available in DateValue, including "Year", "Month", "DayName" and "Week", expressed as a named Slot such as #Year, #Month, etc.
- For DateInterval inputs, DateSelect returns a list of dates using the calendar granularity specified by the interval.
Examples
open all close allBasic Examples (4)
Select all dates in May within a given list of dates:
Get all dates within the 8th week of the year:
Get all Wednesdays within a given date interval:
Select any instance of February 4, as well as all Thursdays within the given range:
Make a selection function to find the fourth day of each odd-numbered month:
Scope (2)
Selection criteria are typically reference date elements using Slot expressions but may use any Boolean criteria:
DateSelect extracts element values without converting calendars or changing time zones:
The value of #Day is determined by the calendar associated with the input date:
The value of #Hour is checked without accounting for differences in time zones:
To select dates using a standardized time zone, first use TimeZoneConvert:
Applications (1)
DateSelect can be used for scheduling purposes, picking out dates that match a given pattern, such as the first Monday in any given month:
Properties & Relations (1)
DateSelect[dates,crit] is equivalent to Select[dates,DateValue[#,elem]==value&]
Possible Issues (1)
Not all calendars include all elements as selection criteria:
Dates may be converted to a different calendar prior to selection using CalendarConvert:
Neat Examples (3)
On the Gregorian calendar, the 13th day of the month is a Friday more frequently than any other day of the week:
Create a criterion for US presidential elections (first Tuesday after the first Monday in November every 4 years):
Use the criterion to find all presidential election days in a 20-year period:
A Gregorian century never begins on a Sunday, regardless of whether it starts on year 1 or year zero:
Related Guides
History
Text
Wolfram Research (2020), DateSelect, Wolfram Language function, https://reference.wolfram.com/language/ref/DateSelect.html.
CMS
Wolfram Language. 2020. "DateSelect." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DateSelect.html.
APA
Wolfram Language. (2020). DateSelect. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DateSelect.html
BibTeX
@misc{reference.wolfram_2025_dateselect, author="Wolfram Research", title="{DateSelect}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/DateSelect.html}", note=[Accessed: 22-November-2025]}
BibLaTeX
@online{reference.wolfram_2025_dateselect, organization={Wolfram Research}, title={DateSelect}, year={2020}, url={https://reference.wolfram.com/language/ref/DateSelect.html}, note=[Accessed: 22-November-2025]}