DIESEL funkce edtime v AutoCADu dokáže dostat z datumu většinu běžně používaných informací v naformátovaném tvaru - viz např. (s LISP funkcí menucmd):
(menucmd "M=$(edtime,$(getvar,date),DDDD\",\" D. MONTH YYYY)")
Tento mechanismus ale nedokáže obrazit den v týdnu ve formě číselného kódu (0=Po,1=Út,6=So...), ani neumí určit pořadové číslo týdne v roce podle ISO 8601.
Pro tyto případy jde použít následující LISP kód vyvinutý Lee Macem:
;; Week Number - Lee Mac
;; Returns the ISO 8601 week number for a given date
(defun LM:weeknumber ( y m d )
( (lambda ( q )
(cond
( (< q 1) (LM:weeknumber (1- y) 12 28))
( (and (< 28 d) (< 51 q) (< (LM:weeknumber y 12 28) q)) 1)
( q )
)
)
(/ (+ (nth m '(0 0 31 59 90 120 151 181 212 243 273 304 334))
(if (and (LM:leapyear-p y) (< 2 m)) 1 0)
(- (LM:weekday y m d)) 9 d
)
7
)
)
)
;; Weekday - Lee Mac
;; Returns an integer 0-6 (0=Monday;6=Sunday) corresponding to the day of
;; the week for a given date
;; Implementation of Zeller's Congruence Algorithm
(defun LM:weekday ( y m d )
(if (< m 3) (setq y (1- y) m (+ m 12)))
(rem (+ 5 d (/ (* 26 (1+ m)) 10) y (/ y 4) (* 6 (/ y 100)) (/ y 400)) 7)
)
;; LeapYear-p - Lee Mac
;; Returns T if the supplied year number is a leap year
(defun LM:leapyear-p ( y )
(and (zerop (rem y 4))
(or (zerop (rem y 400))
(not (zerop (rem y 100)))
)
)
)
;; Added by CADforum: get TODAY's values:
(setq __today (read (menucmd "M=$(edtime,$(getvar,date),\"(\"YYYY M D\")\")")))
(LM:weekday (car __today)(cadr __today)(caddr __today))