如何用lisp取得系数时间和日期
如何用lisp取得系数时间和日期?? ;;;显示日期<BR>(defun c:riqi (/ tmp y m d txt pt1)<BR> (setq tmp (rtos (getvar "cdate") 2 8))<BR> (setq y (rtos (atof (substr tmp 1 4)) 2 0))<BR> (setq m (rtos (atof (substr tmp 5 2)) 2 0))<BR> (setq d (rtos (atof (substr tmp 7 2)) 2 0))<BR> (setq txt (strcat "今天是:" y "年" m "月" d "日"))<BR> (alert txt)<BR> (princ)<BR>) 时间最好能贴到图形上去? kenl3565发表于2004-8-26 9:09:00static/image/common/back.gif时间最好能贴到图形上去?<BR>(defun c:riqi (/ tmp y m d txt pt1)<BR> (setq tmp (rtos (getvar "cdate") 2 8))<BR> (setq y (rtos (atof (substr tmp 1 4)) 2 0))<BR> (setq m (rtos (atof (substr tmp 5 2)) 2 0))<BR> (setq d (rtos (atof (substr tmp 7 2)) 2 0))<BR> (setq txt (strcat "今天是:" y "年" m "月" d "日"))<BR> (COMMAND "style" "宋体" "宋体" h "1" "0" "" "")<BR> (alert txt)<BR> (setq pt1(getpoint"\n\t放置点 : "))<BR> (command "text" "j" "mc" pt1 "0" txt)<BR> (princ)<BR>) 时间在哪呢? (defun c:riqi2 (/ tmp y m d h mn s txt txt1 pt1)<BR> (setq tmp (rtos (getvar "cdate") 2 16))<BR> (setq y (rtos (atof (substr tmp 1 4)) 2 0)<BR> m (rtos (atof (substr tmp 5 2)) 2 0)<BR> d (rtos (atof (substr tmp 7 2)) 2 0)<BR> )<BR> (setq h (rtos (atof (substr tmp 10 2)) 2 0)<BR> mn (rtos (atof (substr tmp 12 2)) 2 0)<BR> s (rtos (atof (substr tmp 14 2)) 2 0)<BR> )<BR> (setq txt (strcat "现在是:" y "年" m "月" d "日" h"时"mn"分"s"秒")<BR> txt1 (strcat y "年" m "月" d "日" h"时"mn"分"s"秒")<BR> )<BR> (COMMAND "style" "宋体" "宋体" "300" "1" "0" "" "")<BR> (alert txt)<BR> (setq pt1(getpoint"\n\t放置点 : "))<BR> (command "text" "j" "mc" pt1 "0" txt1)<BR> (princ)<BR>) <BR> 本帖最后由 作者 于 2004-8-30 3:58:17 编辑
(setq da (rtos(getvar "cdate")2 8)
lst(mapcar '(lambda(x)(substr da (car x) (cadr x))) '((1 4) (5 2) (7 2) (10 2)(12 2)(14 2)(16 2)))
str(apply 'strcat (mapcar '(lambda(x y)(strcat x y)) lst '("年" "月" "日" "时" "分" "秒" "毫秒")))) -》 "2004年08月29日02时24分15秒72毫秒" (menucmd "M=$(edtime,$(getvar,date),YYYY\"年\"M\"月\"D\"日\"H\"时\"MM\"分\"SS\"秒\")")
;;->"2004年8月30日3时54分32秒" 哈哈,都精确到毫秒了,不知道要这么精确做什么用呢?楼主要的日期程序是做什么用呢,需要精确到什么程度啊? <TABLE class=tablebody2 style="TABLE-LAYOUT: fixed; WORD-BREAK: break-all" width="90%" border=0>
<TBODY>
<TR>
<TD style="FONT-SIZE: 9pt; LINE-HEIGHT: 12pt" width="100%"><IMG alt=发贴心情 src="http://www.mjtd.com/bbs/skins/default/topicface/face1.gif" border=0> <B></B><BR>哈哈,真有意思!</TD></TR></TBODY></TABLE> 星期怎么获取呢?
页:
[1]
2