summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--tag-emacs/emacs.d/init.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el
index 176d6ee8..5babb056 100644
--- a/tag-emacs/emacs.d/init.el
+++ b/tag-emacs/emacs.d/init.el
@@ -220,6 +220,14 @@
                  ((equal prefix '(16)) "%A, %d %B %Y"))))
     (insert (format-time-string format))))
 
+(defun insert-datetime (prefix)
+  "Insert the currrent date and time."
+  (interactive "P")
+  (let ((format (cond
+                 ((not prefix) "%Y-%m-%d %H:%M:%S")
+                 ((equal prefix '(4)) "%Y-%m-%dT%H:%M:%SZ"))))
+    (insert (format-time-string format))))
+
 ;;;; Directory browsing
 (req-package dired
   :config (progn