Code Red > AutoLISP (Vanilla / Visual)

Time Zone ..

(1/2) > >>

Kerry:

Has anyone come across a way, from V/Lisp to determine the time offset from GMT ?
If so, care to share ?


--- Code: ---(SETQ d              (RTOS (GETVAR "cdate") 2 6)
      rev::datestamp (STRCAT (SUBSTR d 1 4)
                             "-"
                             (SUBSTR d 5 2)
                             "-"
                             (SUBSTR d 7 2)
                             "T"
                             (SUBSTR d 10 2)
                             ":"
                             (SUBSTR d 12 2)
                             ":"
                             (SUBSTR d 14 2)
                     )
)
--- End code ---

Returns "2007-09-04T11:50:13"
I want to add the time offset
ie; "2007-09-04T11:50:13+10.00"

I'll hack one through a C# interface if really necessary, but in this case I'd prefer vlisp.

For the curious, I'm writing a timestamp to an XML file field that is required to be sortable when imported into SQL

It's Alive!:
how about using WMI?

http://www.microsoft.com/technet/scriptcenter/guide/sas_wmi_fvwp.mspx?mfr=true


--- Code: ---((defun GMT:OFFSET (/ item meth1 meth2 s serx wmi)
 (vl-load-com)
 (setq WMI (vlax-create-object "WbemScripting.SWbemLocator")
       meth1 (VLAX-INVOKE WMI 'ConnectServer nil nil nil nil nil nil nil nil)
       meth2 (vlax-invoke meth1 'ExecQuery "SELECT * FROM  Win32_OperatingSystem")
       s (vlax-for item meth2 (setq serx (list (vlax-get item 'CurrentTimeZone))))
 )
 (vlax-release-object meth1)
 (vlax-release-object meth2)
 (vlax-release-object wmi)
 (/ (car s) 60)
)


(defun WMI:TIME (/ item meth1 meth2 s serx wmi)
 (vl-load-com)
 (setq WMI (vlax-create-object "WbemScripting.SWbemLocator")
       meth1 (VLAX-INVOKE WMI 'ConnectServer nil nil nil nil nil nil nil nil)
       meth2 (vlax-invoke meth1 'ExecQuery "SELECT * FROM  Win32_OperatingSystem")
       s (vlax-for item meth2 (setq serx (list (vlax-get item 'LocalDateTime))))
 )
 (vlax-release-object meth1)
 (vlax-release-object meth2)
 (vlax-release-object wmi)
 (car s)
)

--- End code ---

Kerry:
Perfect Daniel ....

Your blood's worth bottling !!

I just started to look at WMI .. that saves me a heap of testing .. Thanks.

Kerry:
Thanks again Daniel.
I've needed to also extract and format the "TDCREATE" variable ( Time/Date created)
It's become a little heavy, getting the julian time, converting to calendar, getting the GMT Time offset, formatting it all together  ...

.. but it works well.

It's Alive!:
It’s my pleasure Kerry
I’m interested to see how your XML project progresses.

Navigation

[0] Message Index

[#] Next page

Go to full version