Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get UTC date time and convert to bytes using VisualLisp

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
1029 Views, 3 Replies

Get UTC date time and convert to bytes using VisualLisp

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 

3 REPLIES 3
Message 2 of 4
hencoop
in reply to: Anonymous

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

 

AutoCAD User since 1989. Civil Engineering Professional since 1983
Product Ver.: 13.6.1781.0 Civil 3D 2024.3 Update
Built On:        U.152.0.0 AutoCAD 2024.1.2
                        27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
                        8.6.52.0 AutoCAD Architecture 2024
Message 3 of 4
Anonymous
in reply to: hencoop

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
in reply to: Anonymous

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report