DateOverlapsQ[date1,date2]
returns True if the calendar dates date1 and date2 overlap, and False otherwise.
DateOverlapsQ
DateOverlapsQ[date1,date2]
returns True if the calendar dates date1 and date2 overlap, and False otherwise.
Details
- In DateOverlapsQ[date1,date2], both date1 and date2 should be specified as DateObject expressions of any calendar granularity.
- DateOverlapsQ accepts lists of dates in both arguments, effectively calling Outer on the input lists.
- DateOverlapsQ returns True if there is any intersection in the time period represented by date1 and date2.
Examples
open all close allBasic Examples (2)
Now and Today are overlapping:
DateOverlapsQ[Today, Now]But Now and Yesterday are not:
DateOverlapsQ[Yesterday, Now]Test whether a given week overlaps with the year 2022:
DateOverlapsQ[DateObject[{2022}, "Year"], DateObject[{2022, 5, 2}, "Week"]]Scope (3)
Test whether a date overlaps several different dates:
DateOverlapsQ[{Yesterday, Today, Tomorrow}, Now]Test whether several dates overlap a given date:
DateOverlapsQ[DateObject[{2022}, "Year"], {DateObject[{2022, 5, 9}, "Day"], DateObject[{2021, 8, 4}, "Day"], DateObject[{2022, 4}, "Month"]}]Test for overlaps of several dates against several other dates:
DateOverlapsQ[{DateObject[{2022}, "Year"], DateObject[{2021, 12}, "Month"]}, {DateObject[{2022, 6, 17}, "Day"], DateObject[{2021, 12, 25}, "Day"], Entity["Country", "SouthKorea"][EntityProperty["Country", "IndependenceDate"]]}]Properties & Relations (3)
DateOverlapsQ returns True if any part of the dates are overlapping:
DateOverlapsQ[DateObject[{2022, 1}, "Month"], DateObject[{2022, 1, 31}, "Week"]]DateWithinQ will return True only if date2 is entirely contained within date1:
DateWithinQ[DateObject[{2022, 1}, "Month"], DateObject[{2022, 1, 31}, "Week"]]If two dates overlap, their difference will be zero of the largest calendar granularity:
DateOverlapsQ[DateObject[{2022, 1}, "Month"], DateObject[{2022, 1, 31}, "Week"]]DateObject[{2022, 1, 31}, "Week"] - DateObject[{2022, 1}, "Month"]If two date objects overlap, they cannot be compared:
DateOverlapsQ[DateObject[{2021, 8}, "Month"], DateObject[{2021, 8, 4}, "Day"]]DateObject[{2021, 8}, "Month"] < DateObject[{2021, 8, 4}, "Day"]Related Guides
History
Text
Wolfram Research (2017), DateOverlapsQ, Wolfram Language function, https://reference.wolfram.com/language/ref/DateOverlapsQ.html.
CMS
Wolfram Language. 2017. "DateOverlapsQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DateOverlapsQ.html.
APA
Wolfram Language. (2017). DateOverlapsQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DateOverlapsQ.html
BibTeX
@misc{reference.wolfram_2026_dateoverlapsq, author="Wolfram Research", title="{DateOverlapsQ}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/DateOverlapsQ.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_dateoverlapsq, organization={Wolfram Research}, title={DateOverlapsQ}, year={2017}, url={https://reference.wolfram.com/language/ref/DateOverlapsQ.html}, note=[Accessed: 13-June-2026]}