emacs:显示日期之前' n天前'

时间:2016-11-26 20:10:59

标签: date emacs formatting

目前,我的RSS Feed使用此功能显示日期

(format-time-string "%Y-%m-%d %H:%M" (seconds-to-time date))

我希望显示日期" N天前"

这可以用emacs lisp吗?

1 个答案:

答案 0 :(得分:0)

试试这个:

(format "%d days ago"
        (floor
         (/ (float-time (time-subtract (current-time) (seconds-to-time date)))
            (* 60 60 24))))