InsertAnyDate

Instead of InsertingTodaysDate, the following command takes a UniversalArgument that will insert the day ‘days’ from the current date.

  (require 'calendar)
  
  (defun insdate-insert-any-date (date)
    "Insert DATE using the current locale."
    (interactive (list (calendar-read-date)))
    (insert (calendar-date-string date)))
  
  (defun insdate-insert-date-from (&optional days)
    "Insert date that is DAYS from current."
    (interactive (list
                  (read-number (format "days: ")
                               0)))
    (insert
     (calendar-date-string
      (calendar-gregorian-from-absolute
       (+ (calendar-absolute-from-gregorian (calendar-current-date))
  	days))
      t)))

See InsertingAndUpdatingDates for other ways to insert dates in buffers and files.


CategoryCalendar CategoryEditing