is an option that determines the calendar granularity of generated dates.
- DateGranularity is set to Automatic by default.
- Granularity specifications may be any of the following:
"Eternity" an infinite period in the past or future "Millennium" 1000-year period beginning with year XX00 "MillenniumBeginning01" 1000-year period beginning with year XX01 "Century" 100-year period beginning with year XX00 "CenturyBeginning01" 100-year period beginning with year XX01 "Decade" 10-year period including the date "Year" year including the date "Quarter" 3-month quarter including the date "Month" month including the date "Week" week beginning Monday including the date "WeekBeginningSunday" week beginning Sunday including the date "Day" day including the date "Hour" hour including the date "Minute" minute including the date "Second" second including the date "Instant" the exact instant specified
- Constructors of DateObject expressions, such as FromDateString or FromAbsoluteTime, have a DateGranularity option.
Examplesopen allclose all
Basic Examples (2)
By default, DateObject generates dates with calendar granularity determined by the input:
By default, RandomDate dates are generated with "Instant" granularity:
Use DateGranularity"Day" to generate a pseudorandom day:
DateGranularity specifies the output granularity, regardless of the input granularity for the given dates:
Wolfram Research (2022), DateGranularity, Wolfram Language function, https://reference.wolfram.com/language/ref/DateGranularity.html (updated 2023).
Wolfram Language. 2022. "DateGranularity." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2023. https://reference.wolfram.com/language/ref/DateGranularity.html.
Wolfram Language. (2022). DateGranularity. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DateGranularity.html