Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3404842
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:25:57+00:00 2026-05-18T05:25:57+00:00

I want to use Emacs Lisp to perform math operations like add and difference

  • 0

I want to use Emacs Lisp to perform math operations like add and difference on dates and times.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:25:58+00:00Added an answer on May 18, 2026 at 5:25 am

    The short answer is: read the System Interface section of the elisp info manual. More specifically, the time sections:

    • Time of day
    • Time conversion
    • Time parsing
    • Time calculations

    The longer answer:

    Emacs can work with time values as strings, floats, or a tuple of two or three integers. E.g. call some functions in the *scratch*buffer:

    (current-time)
    (19689 59702 984160)
    (current-time-string)
    "Sun Nov 21 20:54:22 2010"
    (current-time-zone)
    (-25200 "MST")
    (float-time)
    1290398079.965001
    

    Let’s some conversions:

    (decode-time (current-time))
    (33 7 21 21 11 2010 0 nil -25200)
    (decode-time) ; (current-time) by default
    (51 7 21 21 11 2010 0 nil -25200)
    
    (let ((seconds 36)
          (minutes 10)
          (hour 21)
          (day 21)
          (month 11)
          (year 2010))
      (encode-time seconds minutes hour day month year))
    (19689 60732)
    
    (format-time-string "%A %e %B" (current-time))
    "Sunday 21 November"
    
    (seconds-to-time 23)
    (0 23 0)
    
    (time-to-seconds (current-time))
    1290399309.598342
    
    (time-to-days (current-time))
    734097
    

    Finally, to answer your question:

    (time-add (current-time) (seconds-to-time 23))
    (19689 60954 497526)
    
    (time-subtract (current-time) (seconds-to-time 45))
    (19689 61001 736330)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use emacs in ubuntu 12.04. i want define some background or foreground in
I use Cocoa Emacs 23.1.91 and I want to always have hl-line-mode turned off
I want to use intelligent tabbing in Emacs in C++ mode, but I also
I'm new to emacs and I want to use ensime in Windows. I had
I've recently moved from vim to Emacs because I want to use org-mode .
I want to use Emacs for simple text annotation. Is there a command which
I want to index clojure files, using etags so that i can use Emacs's
When I use Emacs I want to be able to easily display and navigate
I'd like to use emacs style keyboard macros in Visual Studio, which for the
I am trying to use Emacs as a beginner. I want to configure it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.