Wolfram Computation Meets Knowledge

Wolfram Language & System Documentation Center Wolfram Language Home Page »

DateObject

DateObject[]

gives the current local date.

DateObject[date]

gives a date object corresponding to the given date specification.

DateObject[rdate,gran]

gives the date object of calendar granularity gran that includes the reference date rdate.

Details and Options

Examples

open allclose all

Basic Examples  (6)

Find the current date:

Date object expression representing the year 2022:

Date object representing the week beginning Monday, August 1, 2022:

Expand the date to a granularity of "Month":

Convert an absolute time to a date object:

Represent a specific year and month:

Or represent just a year:

Add 2000 weeks to a date:

Subtract two dates to get a time quantity:

Scope  (7)

Date objects are interpreted using their standard normalized form:

This includes normalization for values preceding the first day of the year:

Strings are automatically interpreted when possible:

DateObject automatically chooses the first date compatible with the input information:

The granularity of a date object may be changed by wrapping it in a DateObject expression with an explicit granularity specification:

Date objects including additional elements beyond what are required for a given calendar granularity will be automatically normalized to their canonical form:

Combine a DateObject and a TimeObject into a single expression:

Date and time of an image:

Options  (9)

CalendarType  (2)

Find the current date on the Jewish calendar:

Represent a date on the Islamic calendar:

DateFormat  (2)

Use long date format:

Specify your own format:

DateGranularity  (1)

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

Use DateGranularity"Month" to generate a "Month" granular date:

TimeSystem  (2)

Find the current date in International Atomic Time:

Represent the leap second that occurred on December 31, 2016, in Coordinated Universal Time:

The "UTC" and "SmearedUTC" time systems are identical on days with no leap second added:

They differ on days with a leap second, with the difference increasing from 0 to 1 second during the day:

TimeZone  (2)

Find the current date in Greenwich, United Kingdom:

Specify no time zone for a date object:

Represent 11am Eastern Standard Time on March 3, 2001:

TimeZone specifications can be used with all supported calendar types:

For date string inputs, if a time zone is detected, the resulting DateObject will account for the difference in time zone offset:

Properties & Relations  (9)

AbsoluteTime represents dates as seconds since the beginning of 1900:

DateList represents dates as lists of date elements:

DateString represents dates as strings:

DateValue can be used to extract a granular date:

Arithmetic using date objects returns units in the coarsest granularity of the dates:

Granular DateObject expressions with different time zones within the same calendar granularity are considered Equal:

But are not SameQ:

Compare date objects to determine their sequence of occurrence:

GreaterThan, LessThan and related test functions also work with DateObject expressions:

Comparisons of date objects with unequal precision and overlapping time periods will return unevaluated:

Use Max to find the latest date in a list:

NumericalSort will arrange dates in sequence:

ClockGauge can be used to visualize a date on an analog clock:

Wolfram Research (2014), DateObject, Wolfram Language function, https://reference.wolfram.com/language/ref/DateObject.html (updated 2023).

Text

Wolfram Research (2014), DateObject, Wolfram Language function, https://reference.wolfram.com/language/ref/DateObject.html (updated 2023).

CMS

Wolfram Language. 2014. "DateObject." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2023. https://reference.wolfram.com/language/ref/DateObject.html.

APA

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

BibTeX

@misc{reference.wolfram_2024_dateobject, author="Wolfram Research", title="{DateObject}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/DateObject.html}", note=[Accessed: 18-May-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_dateobject, organization={Wolfram Research}, title={DateObject}, year={2023}, url={https://reference.wolfram.com/language/ref/DateObject.html}, note=[Accessed: 18-May-2024 ]}

Top