Questions tagged [parse-time]
20 questions
13
votes
2 answers
Parsing formatted time string (inverse of format-time-string)
The format-time-string function takes a time argument like '(21761 64499 350937 0) and a format string like "%y-%m-%d %a %H:%M" and returns something like "15-03-12 Thu 16:49".
What is the inverse function, which takes "15-03-12 Thu 16:49" and…

Matthew Piziak
- 5,958
- 3
- 29
- 77
6
votes
1 answer
How to make org-mode DWIM when it reads times in timestamps?
Q: how can I make org-mode read the time in timestamps intelligently?
org-mode uses org-read-date (which in turn relies on parse-time-string) to create/modify timestamps, scheduled items, and deadlines. I'm trying to figure out how to make it…

Dan
- 32,584
- 6
- 98
- 168
6
votes
1 answer
How to make org-mode understand alternate day/month abbreviations?
Q: How can I make org-mode understand alternate day/month abbreviations?
org-mode uses the function org-read-date when entering timestamps, scheduling dates, and creating deadlines. One may enter three-letter day or month abbreviations (e.g., "sun"…

Dan
- 32,584
- 6
- 98
- 168
4
votes
1 answer
How do I interconvert Calc's HMS forms and seconds?
Is there a built-in way to convert/toggle between GNU Emacs Calc's HMS forms and seconds? I'd also like to easily be able to add numbers as seconds and/or minutes to an existing HMS form.

user117529
- 151
- 4
3
votes
1 answer
How to add a time and a time interval in calc-mode?
How do I use calc to add a time interval to a moment in time (i.e., a date, or a time)?
For instance, say I want to know what the time and day will be 8,000 minutes into the future?
I know that t N will push the current moment onto the stack. And I…

algal
- 315
- 2
- 9
3
votes
2 answers
How to make org-mode timestamps understand a new abbreviation for "tomorrow"?
Q: How can I make org-read-date understand an abbreviation that calls a function that returns tomorrow's day of the week?
The super-short version: I'm trying to get the timestamp functionality of +1d when typing tom as a more finger-friendly way of…

Dan
- 32,584
- 6
- 98
- 168
3
votes
1 answer
Compare file modification time stamps
Background
I am using Emacsclient to open files in a Emacs server. The server configuration depends on the content of a JSON configuration file. A Perl script can read the config file and write a suitable Emacs Lisp hashtable load file, which the…

Håkon Hægland
- 3,608
- 1
- 20
- 51
2
votes
1 answer
How to compare date strings?
I have a LaTeX package declared with a date:
\usepackage{foo}[=2021-04-01]
and I need to check if this date is before or after "2021-03-01".
Is there a way to compare dates, like (if (< date1 date0) ... )?
Raw solution
Thanks to @Drew's answer I…

Onner Irotsab
- 431
- 2
- 9
2
votes
1 answer
org-mode timestamp repeater interval manipulation
What are (if any) the lisp functions to read and write the repeater interval part of the org-mode timestamps? (The ones at the end of the timestamp string, which are optional, e.g. +1w or +6d in <2016-03-03 Thu .+6d -3d> or [2016-01-27 Wed ++1w…

Alexander Shcheblikin
- 855
- 8
- 19
2
votes
0 answers
How to parse calendar date or timestamp at cursor from elisp?
Is there a function to parse the text around the cursor and return the date if found?
E.g., if I'm in a buffer with the cursor in the middle of this text:
2015-12-01 First day of new exercise program
2016-01-08 Hit a milestone: ran a…

nealmcb
- 194
- 5
1
vote
1 answer
Setting minimum time between consecutive reparses by semantic
According to the Semantic docs, semantic-edit.el is the file which handles all incremental parsing. I see frequent incremental parse errors(not information messages, since I have semantic-edits-verbose-flag nil) and would like to set a minimum time…

Pradhan
- 2,330
- 14
- 28
1
vote
1 answer
Convert a timestamp to local time
I have a timestamp string "2011-01-23T16:18:46-08:00" and I want to convert it to my local time zone.
(format-time-string
"%Y-%m-%dT%H:%M:%S%z"
(decode-time (parse-iso8601-time-string "2011-01-23T16:18:46-08:00")))
gives…

Hatshepsut
- 545
- 3
- 14
1
vote
0 answers
time-zone-valid-p: Is there such a function?
I am trying to debug an invalid timezone '(nil nil nil) that is causing encode-time to choke on the optional ZONE argument.
Q: Is there a time-zone-valid-p function anywhere that I can use to test the ZONE before passing it to encode-time?

lawlist
- 18,826
- 5
- 37
- 118
1
vote
3 answers
How can I convert a list of integers to a string?
Let's say I have a list of integers, representing year, month, day for a date:
(2017 8 21)
and I want to format the list in one function call, as in
(format "%04d-%02d-%02d" 2017 8 21)
Is there an easy way to do this? I know I could assign the…

Niclas Börlin
- 618
- 5
- 15
1
vote
1 answer
What's the inverse of (format-time-string "%s")?
Parsing formatted time string (inverse of format-time-string) asks for a complete inverse of format-time-string with the ability to specify the source format, but I really just need to get from a UNIX time / epoch time to a real time value (like…

Sean Allred
- 6,861
- 16
- 85