2022-09-06 16:14:28 +00:00
|
|
|
;; -*- lexical-binding: t; -*-
|
|
|
|
(defun unix-time-to-string (epoch-seconds &optional format-string)
|
|
|
|
"Converts an epoch timestamp into a human-readable string."
|
2022-10-05 15:54:07 +00:00
|
|
|
(interactive "nUnix timestamp: ")
|
|
|
|
(let* ((format-string (or format-string "%FT%T%z"))
|
|
|
|
(formatted (format-time-string format-string epoch-seconds)))
|
|
|
|
(if (called-interactively-p)
|
|
|
|
(message formatted)
|
|
|
|
formatted)))
|
2022-09-06 16:14:28 +00:00
|
|
|
|
|
|
|
(provide 'init-utils)
|