CAD tip # 14363:
Question
But how to insert a dynamic date "yesterday", "tomorrow", "two days ago", "a week ago", "six months ago", "a month ago", etc. into the drawing?
The DATE variable will help in this. It stores the time as a Modified Julian Date (aka "UT1"), as a decimal number (1 day is 1.00). Days and hours are counted from 12:00 AM on January 1, 4713 BC.
In combination with a DIESEL expression, you can then use simple calculations in FIELD to create derived dates related to "now", i.e. today.
E.g.:
$(edtime,$(-,$(getvar,date),1),D.MONTH YYYY - hh:mm)
displays the date "1 day less" (= yesterday), in the format 2.January 2025 - 07:44.
And similarly:
$(edtime,$(+,$(getvar,date),7),D.MONTH YYYY - hh:mm)
$(edtime,$(+,$(getvar,date),365),D.MO.YYYY)
represents the date "in a week", resp. "in a year", etc.
The red underlined part specifies arithmetic operations with the date, the blue underlined part specifies the format of the date display.
You can even use conditional DIESEL expressions, e.g. to highlight overdue terms:
Due date: $(if,$(>,$(getvar,date),2460679.0),"OVERDUE",$(edtime,$(-,$(getvar,date),1),D.M.YYYY - hh:mm))

