Get UTC date time and convert to bytes using VisualLisp

Get UTC date time and convert to bytes using VisualLisp

Anonymous
Not applicable
1,662 Views
3 Replies
Message 1 of 4

Get UTC date time and convert to bytes using VisualLisp

Anonymous
Not applicable

Hi, 

 

I'm new to AutoLisp. I am wondering if there is a way to get DateTime in UTC. 
I know we can use CDate and Date but it only return PC date.

And also how to convert Date Time to bytes?

 

Thank you so much 

0 Likes
1,663 Views
3 Replies
Replies (3)
Message 2 of 4

hencoop
Advisor
Advisor

I'm not sure of exactly what you are looking for but DOSLIB from Robert McNeel & Associates has some date tools (and lots of other good tools) that could help you.

 

DOS_CDATE.jpg

 

Henry C. Francis
Authorized Autodesk Developer
Civil Design Specialist – Water & Wastewater Infrastructure
Message 3 of 4

Anonymous
Not applicable

I need to get current UTC datetime with autolisp.

 

I tried common lisp comand use (get-universal-time) . It will return 

 

                        ; error: no function definition: GET-UNIVERSAL-TIME

 

Now my code is 

 

(defun c:testing
  (setq time (rtos (getvar "CDATE")))
  (princ)
  (princ time)  
  (princ)
)

 

It returns 

 

20170329.0941  (current PC datetime)

 

 

I need to return 

20170329.0141  (current UTC datetime)

 

 

 

Message 4 of 4

dbroad
Mentor
Mentor

If you're trying to get a time 8 hours earlier in a string similar to CDATE, then this should work:

(menucmd "M=$(edtime,$(-,$(getvar,date),0.3333333333),YYYYMODD\".\"HHMMSSMSEC)")
Architect, Registered NC, VA, SC, & GA.