picks out all dates datei of a list for which crit[datei] is True.
returns all dates within the DateInterval int for which crit[datei] is True.
represents an operator form of DateSelect that can be applied to an expression.
- 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.
Examplesopen allclose all
Basic Examples (4)
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:
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:
Wolfram Research (2020), DateSelect, Wolfram Language function, https://reference.wolfram.com/language/ref/DateSelect.html.
Wolfram Language. 2020. "DateSelect." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DateSelect.html.
Wolfram Language. (2020). DateSelect. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DateSelect.html