Next: , Up: Time   [Index]


I.2.1 Current Time

Functions on this Page

current-time-string

current-time

float-time

time-to-seconds

Function: current-time-string &optional TIME ZONE

(current-time-string) => "Fri Nov 1 15:59:49 2019"

Returns the current time7 as a human-readable string. The format does not vary for the initial part of the string, which contains the day of week, month, day of month, and time of day in that order: the number of characters used for these fields is always the same. It is typically more convenient to use format-time-string than to extract fields from the output of current-time-string.

The optional argument ‘ZONE’ defaults to the current time zone rule.

Function: current-time

This function returns the current time as a Lisp timestamp in the form8:

  • (high low micro pico)
Function: float-time &optional TIME

This function returns the current time as a floating-point number of seconds since the epoch. Since the result is floating point, it may not be exact. Do not use this function if precise time stamps are required.

time-to-seconds is an alias for this function.


Footnotes

(7)

The operating system limits the range of time and zone values.

(8)

This is planned to change in a future Emacs version.