25 votes

Is there a mode to automatically update copyright years in files?

You can use the copyright-update function. I would read the docs for the function. and others inside copyright.el for more info, but as a simple example, If I have: ;; Copyright (C) 2014, Jordon ...
user avatar
12 votes
Accepted

Change date from active to inactive

TL;DR; From the keyboard (in org-mode): C-c . to activate (convert from inactive to active). C-c ! to inactivate (convert from active to inactive). From lisp: (org-time-stamp t) to activate, ...
user avatar
  • 1,173
9 votes
Accepted

Elisp function to see a date for next Wednesday

Emacs's built-in date parser is parse-time-string in parse-time.el, called by date-to-time. It understands English month and weekday names and several combinations of elements in various orders, but ...
user avatar
9 votes
Accepted

How to insert inactive [timestamp] via function?

From the documentation of org-time-stamp: With two universal prefix arguments, insert an active timestamp with the current time without prompting the user. So eval the below: (org-time-stamp '(...
user avatar
  • 24.3k
9 votes
Accepted

Counting the number of days that have passed since a certain date

I write "<2016-06-15 Wed>--<2016-07-18 Mon>" ...and then (with POINT somewhere over the dates) I press C-c C-y (org-evaluate-time-range) C-ucy will write the time-range after the dates like, &...
user avatar
  • 407
7 votes
Accepted

Converting plain text to dates

Internally, org-mode uses the function org-read-date to do this: (org-read-date &optional ORG-WITH-TIME TO-TIME FROM-STRING PROMPT DEFAULT-TIME DEFAULT-INPUT INACTIVE) For example, (org-read-...
user avatar
  • 12.2k
7 votes

How to display time in seconds in the mode line?

The top of the EmacsWiki page on Display Time tells you how to control the format of the time. Of the three variables, it looks like display-time-format is the most relevant after inspecting the ...
user avatar
  • 31.1k
7 votes
Accepted

How can I change Org-mode time format for one buffer?

You need to define the variable org-time-stamp-custom-formats, not to call a function. What you type after the variable name and colon is a value (what you might type after '). -*- org-time-stamp-...
user avatar
7 votes

Convert Unix time to Org-mode timestamp

As lawlist mentioned in the comment, running the following in your own Emacs will return what you want (format-time-string "<%Y-%m-%d %a %H:%M:%S>" (seconds-to-time 1523473110)) ;; => "<...
user avatar
  • 13.7k
7 votes
Accepted

Display relative dates in org-mode property drawers

The command org+-dateprop defined in the following Elisp code does what you want. It puts overlays with a display property on the absolute dates that shows the relative dates instead. This has the ...
user avatar
  • 30.4k
6 votes
Accepted

in org-mode, how to insert timestamp with today's date?

With a bit of guesswork: (org-insert-time-stamp (current-time))
user avatar
  • 13.6k
6 votes

Is there a mode to automatically update copyright years in files?

Here's what I use: (when (fboundp 'copyright-update) (setq copyright-names-regexp "Monnier\\|Free Software") (add-hook 'before-save-hook #'copyright-update))
user avatar
  • 25.4k
6 votes
Accepted

Convert org-time-stamp

You can use org-read-date to convert timestamp strings into internal times (org-read-date nil t "<2015-11-06>" nil) This can be compared to either (org-read-date nil t "today" nil) which ...
user avatar
  • 12.2k
6 votes
Accepted

in yasnippet, how to insert variable date with fixed time of day?

You can use the format-time-string function to format the time in different ways, for your example this should work: * TODO meditate SCHEDULED: `(format-time-string "<%Y-%m-%d %a 8:30am>" (...
user avatar
  • 3,261
6 votes
Accepted

Specify timezone in Org date format

Time zone informatian is not currently part of date formats in org-mode and thus not part of the output from C-c .. Like C-c C-c on a timestamp any extraneous material in the date specification is ...
user avatar
  • 3,287
6 votes
Accepted

Yasnippet invoked org-time-stamp function inserts double timestamp

This happens because org-insert-time-stamp inserts a time stamp (like the name says), but also returns the time stamp. Yasnippit inserts the return value but you're also left with the one inserted by ...
user avatar
  • 12.2k
6 votes
Accepted

Is it possible to change and freeze the current date-time in Emacs?

Sure such evil stuff is possible with elisp. But be warned. I am not aware of all the dark consequences that this evil piece of black art has. When you interactively run freeze-time you can input the ...
user avatar
  • 30.4k
6 votes

Show time in different time zones

I start typing different keywords in M-x and see completion to: display-time-world That is mostly what I look for: display-time-world is an interactive autoloaded compiled Lisp function in `time.el'...
user avatar
  • 3,130
6 votes

Counting the number of days that have passed since a certain date

The original poster may wish to have a look at the built-in function called calendar-count-days-region described in the manual: https://www.gnu.org/software/emacs/manual/html_node/emacs/Counting-Days....
user avatar
  • 17.8k
6 votes
Accepted

org column view with date calculations

The Org syntax for the DEADLINE event differs from what you use in your question. Instead of * TODO fix this bug asap :PROPERTIES: :UPDATE: writing test cases almost there! :LASTUPDATED: 2019-11-25 :...
user avatar
  • 30.4k
6 votes
Accepted

Insert an arbitrary timestamp

To insert a timestamp four months from today, press: C-c . +4m RET and the +4m cookie shifts the date for you. Likewise, use -4m to insert four months before today (y, m, w, and d letters are all ...
user avatar
  • 3,494
6 votes
Accepted

How to subtract time values formatted as "HH:mm"?

This way I get the error Invalid time specification. OK. Maybe I need to encode times first: Indeed. Now I get the error Wrong type argument: fixnump, nil. This is because parse-time-string is ...
user avatar
  • 11.4k
5 votes
Accepted

Compare file modification time stamps

The function you are looking for is file-attributes. The help text is fairly detailed but you will be wanting: 4. Last access time, as a list of integers (HIGH LOW USEC PSEC) in the same style as (...
user avatar
  • 4,546
5 votes

Parsing formatted time string (inverse of format-time-string)

parse-time-string parses "standard" time strings, as does org-parse-time-string. The documentation claims the latter will be faster. Neither gives a way to specify the format of the string. There is ...
user avatar
  • 12.2k
5 votes
Accepted

The time of the last change of the current buffer

Use the standard change hooks to record that information: https://www.gnu.org/software/emacs/manual/html_node/elisp/Change-Hooks.html#Change-Hooks If you record it, make sure it's in a buffer-local ...
user avatar
5 votes
Accepted

How can I convert a list of integers to a string?

You can use the apply function to pass a function arguments contained in a list as separate arguments. For example: (apply #'format "%04d-%02d-%02d" '(2017 8 21)) That way you can store the list in ...
user avatar
  • 4,612
5 votes

How do I interconvert Calc's HMS forms and seconds?

One way of going from an HMS form to the number of seconds is hinted by a line from the HMS forms page: Dividing two HMS forms produces a real-valued ratio of the two angles. So if an HMS form is ...
user avatar
5 votes

Table formula for dates delta

Solution with calc hms duration strings If you are a bit more flexible with the duration format you can use the hms form of calc. The advantage is that you can further process these values with calc ...
user avatar
  • 30.4k
5 votes
Accepted

Inserting timestamp in mini buffer in Emacs

I have the following in my .emacs: ;; date (global-set-key "\C-\M-d" (lambda (arg) (interactive "P") (let ((separator (pcase arg ('(4) "-") ...
user avatar
  • 1,762
4 votes

How can I change Org-mode time format for one buffer?

The following will work: # Local Variables: # org-time-stamp-custom-formats: ("<%Y-%m>" . "<%Y-%m %H:%M>") # eval: (org-toggle-time-stamp-overlays) # End: Using (org-...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible