help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: insert date/time


From: Miles Bader
Subject: Re: insert date/time
Date: Wed, 30 Mar 2005 09:09:39 +0900

gooliver <gooliverNOSP@Mlibero.it> writes:
> I have emacs 21.3 for windows. How to insert actual date/time
> in this format:
>
> XX <Month> XXXX, <Day> - h.XX:XX

You could define an elisp function, like:

   (defun insert-wacky-time ()
     (interactive)
     (insert
      (format-time-string "%d %B %Y, %A - h.%02H:%02M")))

And then bind it to a key, or call it using M-x.  See the documentation
for `format-time-string' as to the details of the various escape
sequences.

BTW that will use the current locale's names for day/month; if you want
it to always use "standard" names, you should force format-time-string
to use the "C" locale, by binding `system-time-locale':

   (defun insert-wacky-time ()
     (interactive)
     (let ((system-time-locale "C"))
       (insert
        (format-time-string "%d %B %Y, %A - h.%02H:%02M"))))

-Miles
-- 
Is it true that nothing can be known?  If so how do we know this?  -Woody Allen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]