DateGranularity

DateGranularity

is an option that determines the calendar granularity of generated dates.

Details

  • 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

Examples

open allclose all

Basic Examples  (1)

By default, RandomDate dates are generated with "Instant" granularity:

Use DateGranularity"Day" to generate a pseudorandom day:

Generate dates with calendar granularity "Month":

Scope  (2)

Available granularity specifications depend on the calendar associated with the date:

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.

Text

Wolfram Research (2022), DateGranularity, Wolfram Language function, https://reference.wolfram.com/language/ref/DateGranularity.html.

CMS

Wolfram Language. 2022. "DateGranularity." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DateGranularity.html.

APA

Wolfram Language. (2022). DateGranularity. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DateGranularity.html

BibTeX

@misc{reference.wolfram_2022_dategranularity, author="Wolfram Research", title="{DateGranularity}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/DateGranularity.html}", note=[Accessed: 04-February-2023 ]}

BibLaTeX

@online{reference.wolfram_2022_dategranularity, organization={Wolfram Research}, title={DateGranularity}, year={2022}, url={https://reference.wolfram.com/language/ref/DateGranularity.html}, note=[Accessed: 04-February-2023 ]}