add basic time helper functions for use in complex capture templates
This commit is contained in:
parent
b777182c81
commit
54658e937e
|
@ -191,3 +191,23 @@ position between last non-whitespace and `end-of-line'."
|
|||
(interactive)
|
||||
(kmn/dock-current-buffer-on-side 'bottom)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; perform days math on a date string
|
||||
(defun kmn/date-string-days-math (date-string days-to-subtract)
|
||||
(format-time-string "%Y-%m-%d"
|
||||
(encode-time
|
||||
(decoded-time-add (parse-time-string date-string) (make-decoded-time :day days-to-subtract))
|
||||
)
|
||||
))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; subtract 7 days from a date string
|
||||
(defun kmn/date-string-minus-seven-days (date-string)
|
||||
(kmn/date-string-days-math date-string -7)
|
||||
)
|
||||
|
||||
; subtract 3 days from a date string
|
||||
(defun kmn/date/string/minus-three-days (date-string)
|
||||
(kmn/date-string-days-math date-string -3)
|
||||
)
|
||||
|
|
Reference in a new issue