Skip to main content

Emacs获取当前系统时间生成文件名

鱼雪

格式化当前时间函数

  1. Format yyyy-mm-dd
(format-time-string "%Y-%m-%d")
;; "2022-11-28"
  1. Unix Time Format(number of seconds since 1970-01-01)
(format-time-string "%s")
;; "1669620311"
  1. Names for Month and Week
(format-time-string "%B") ; "November"
(format-time-string "%b") ; "Nov"
(format-time-string "%A") ; "Monday"
(format-time-string "%a") ; "Tue"
  1. Timezone
(format-time-string "%z")

拼接字符串(concat)

(concat "/path/to/root" "cur_dir" "file_name" ".extend")

打开(创建)当天日期文件

(open-file
(concat "~/org" (format-time-string "%Y-%m-%d") ".org"))