Skip to content

Instantly share code, notes, and snippets.

@mnuessler
Last active February 27, 2021 19:12
Show Gist options
  • Save mnuessler/e1036908ef313a3a6ad7701765f71d7d to your computer and use it in GitHub Desktop.
Save mnuessler/e1036908ef313a3a6ad7701765f71d7d to your computer and use it in GitHub Desktop.
Emacs Lisp interactive function that prompts for a unix epoch time stamp and converts it into a human readable date.
(defun unix-timestamp-to-date ()
"Prompts for a unix epoch time stamp and converts it to a human-readable date"
(interactive)
(let* ((time-zone "UTC")
(time-unix (seconds-to-time (read-number "Unix epoch time stamp: ")))
(time-str (format-time-string "<%Y-%m-%d %a %H:%M:%S>" time-unix time-zone)))
(message "Date: %s (%s)" time-str time-zone)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment