我正在尝试通过以下函数在Common Lisp中获取当前系统日期。
(defun current-date-string ()
"Returns current date as a string."
(multiple-value-bind (sec min hr day mon yr dow dst-p tz)
(get-decoded-time)
(declare (ignore sec min hr dow dst-p tz))
(format nil "~A-~A-~A" yr mon day)))
不幸的是我得到的当前日期格式是 "2014-1-2"。但实际上我需要的是这种格式 "2014-01-02"。有没有办法可以更改格式?我尝试用 yyyy-mm-dd 替换 nil 但没有成功。然而我的机器时钟显示的日期格式是 "2014-01-02"。