Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DATE Variable 2

Status
Not open for further replies.

Volk359

Technical User
Jun 30, 2004
395
US
Back in the ol' R14 days you could read the current date from the TODAY variable. Somewhere between R14 and 2002 it got removed and now the date is stored in DATE however the format is in decimal form.

Is there a formula to change the decimal into a date format? I use a script to update a date field in our title block.

Thanks.
 
load this lisp in autocad and then just call GETCDATE from the command line (your script) to get it to return the date string

(defun C:GETCDATE (/ CDATE)
(setq CDATE (rtos (getvar "CDATE") 2 6)
CDATE (strcat
(substr CDATE 5 2)
"/"
(substr CDATE 7 2)
"/"
(substr CDATE 3 2)
)
)
)
 
Your code works great by itself but it doesn't work within the script I'm using. I probably should have been a bit clearer; the script I use loads a lisp which does the actual field update. The lisp requires the following format (which is in the script):

(lisp "block" "tag" "new value")

such as:

(ATT_REPL "TITLEBLOCK" "TB_DATE" "02/15/05")

In the past I was able to use:

(ATT_REPL "TITLEBLOCK" "TB_DATE" TODAY)

and in replacing TODAY with GETCDATE I get a "bad DXF group: (1)" error.
 
You should use "(c:getcdate)" in place of "today" (without quotes)
 
Thanks, that did the trick. A star for both of you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top