DATE (System Variable)

Stores the current date and time in Modified Julian Date format.

Saved in:Not-saved
Initial value:Varies

The Modified Julian Date (MJD) format is a Julian day number with decimal fraction of a day:

<Julian day number>.<Decimal fraction of a day>

The Modified Julian Date, conventionally called UT1, is a worldwide scientific standard that assigns day numbers beginning at an essentially arbitrary date and time of 12:00 a.m. on 1 January 4713 B.C. (B.C.E.). With this system, 4 July 1997 at 2:29:58 p.m. corresponds to 2450634.60387736, and 1 January 1998 at 12:00 noon corresponds to 2450815.50000000.

Because the system clock provides the current date and time, the DATE system variable returns a true Julian date only if the system clock is set to UTC/Zulu (Greenwich Mean Time). TDCREATE and TDUPDATE have the same format as DATE, but their values represent the creation time and last update time of the current drawing.

You can compute differences in date and time by subtracting the numbers returned by DATE. The number of seconds since midnight can be computed by multiplying the decimal fraction of DATE by 86400 seconds.

Note: Starting with AutoCAD 2017-based products, the current system date and time stored in the DATE system variable is accurate to the current second; whereas in previous releases the current system time also included milliseconds. If you are using the DATE system variable to track changes between a start and end time, be warned that you will no longer see a change in time until one second has elapsed even though 0 to 999 milliseconds might have passed. When needing to calculate differences in time smaller than one second, consider using the value returned by the MILLISECS system variable.

In AutoCAD-based products, not AutoCAD LT, AutoLISP can be used to calculate the number of seconds since midnight from the value returned by DATE.

(setq s (getvar "DATE"))
(setq seconds (* 86400.0 (- s (fix s))))
Note: If you are using an AutoCAD-based product, not AutoCAD LT, the DATE Express Tool can be used as well as the DATE system variable. The DATE Express Tool functions like a command and uses a string format such as Mon 2012/5/7 10:29:10.563. To see the current value of the DATE system variable in AutoCAD-based products, enter SETVAR and then enter DATE at the prompt.