[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to insert a timestamp?
From: |
' |
Subject: |
Re: how to insert a timestamp? |
Date: |
7 Jan 2004 23:43:24 -0800 |
Thanks for your help! I had never actually written an Emacs Lisp
function before, but with this handy link:
http://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/index.html
I was able to quickly produce the following:
(defun timestamp ()
"Insert timestamp at point."
(interactive)
(insert (format-time-string "%a, %d %b %Y %H:%M:%S %z")))
(global-set-key [f5] 'timestamp)
I love it! Emacs rocks!
Adam
Benjamin Rutt <brutt+news@bloomington.in.us> wrote in message
news:<wc365ford5w.fsf@mu.cis.ohio-state.edu>...
> ack94598@yahoo.com (') writes:
>
> > How can I insert a string representing the current time/date at the
> > point? It is for timestamping entries in a diary/log.
>
> I use:
>
> (insert (format-time-string "%a %b %e, %Y %l:%M %p"))
>
> which gives (ATM): Tue Jan 6, 2004 4:15 PM
>
> There are a zillion other ways to do it. See C-h f
> format-time-string.