Jump to content

time convert


SELFCAD

Recommended Posts

Hello everybody,

I want to convert time format and i don't know how.

This function i use to obtain time when a file was modified:

(defun time (Fil x / FilObj FilSys RetVal)
(setq FilSys (vlax-create-object "Scripting.FileSystemObject")
      RetVal (cond
              ((= (vlax-invoke FilSys 'FileExists Fil) 0) nil)
              ((setq FilObj (vlax-invoke FilSys 'GetFile Fil))
               (list
                (cond
	   ((= (strcase x T) "datecreated")        (vlax-get FilObj 'DateCreated))
	   ((= (strcase x T) "datelastmodified")   (vlax-get FilObj 'DateLastModified))
	   ((= (strcase x T) "datelastaccessed")   (vlax-get FilObj 'DateLastAccessed))
	   ((= (strcase x T) "name")               (vlax-get FilObj 'Name))
	   ((= (strcase x T) "type")               (vlax-get FilObj 'Type))
	 )  
               )
              )
              (T nil)
             )
)
(if FilObj (vlax-release-object FilObj))
(vlax-release-object FilSys)
RetVal
);end defun


I obtain a value like 42812.651. How to convert this value to 2017-May-20 15:50:20 ? with diesel ...but how? Thanks!

Link to comment
Share on other sites

Try the following:

(defun foo ( x p )
   (menucmd (strcat "m=$(edtime," (rtos (+ 2415019 x) 2 15) "," p ")"))
)

For example:

_$ (foo 42812.651 "yyyy-mo-dd hh:mm:ss")
"2017-03-18 15:37:26"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...