qazxswk 发表于 2022-1-30 17:37:12

rtos (getvar "cdate" )获取时间的问题

通常,通过函数(rtos (getvar "cdate" ) 2 6 )这样,可以获取年月日.时分秒。
我有个疑问,如果我想获取得月日时分秒,而且不要那个小数点。怎样写代码?

unclearriver 发表于 2022-1-30 18:19:55

(defun c:bb()
        (setq time (rtos (getvar "Cdate")2 6))
        (strcat (substr time 5 2) "月" (substr time 7 2) "日" (substr time 10 2) "时" (substr time 12 2) "分" (substr time 14 2) "秒")
)

qazxswk 发表于 2022-1-30 19:58:10

unclearriver 发表于 2022-1-30 18:19
(defun c:bb()
        (setq time (rtos (getvar "Cdate")2 6))
        (strcat (substr time 5 2) "月" (substr time ...

谢谢,问题解决了。

菜卷鱼 发表于 2022-2-9 09:14:53

用这个
(menucmd "M=$(edtime,$(getvar,date),YYYYMODDHHMMSS)")

qazxswk 发表于 2022-2-10 20:10:59

菜卷鱼 发表于 2022-2-9 09:14
用这个
(menucmd "M=$(edtime,$(getvar,date),YYYYMODDHHMMSS)")

嗯,你这个办法也不错。谢谢

guankuiwu 发表于 2023-4-18 09:34:10

不错的知识点!
页: [1]
查看完整版本: rtos (getvar "cdate" )获取时间的问题