在Emacs Lisp中插入整个月份的日期,可以使用以下代码:
(insert (format-time-string "%Y-%m-%d"))
这段代码会插入当前日期,格式为年-月-日,例如:2022-08-15。如果需要插入整个月份的日期,可以使用以下代码:
(let* ((today (current-time))
(month (calendar-extract-month (calendar-current-date)))
(year (calendar-extract-year (calendar-current-date)))
(last-day (calendar-last-day-of-month month year)))
(insert (format-time-string "%Y-%m-%02d" (encode-time 0 0 0 last-day month year))))
这段代码会插入当前月份的最后一天日期,格式为年-月-日,例如:2022-08-31。
领取专属 10元无门槛券
手把手带您无忧上云