unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Miles Bader <miles@gnu.org>
Subject: Re: insert date/time
Date: Wed, 30 Mar 2005 09:09:39 +0900	[thread overview]
Message-ID: <87hdiuq9j0.fsf@tc-1-100.kawasaki.gol.ne.jp> (raw)
In-Reply-To: <dpk2e.35845$zZ1.1064841@twister1.libero.it> (gooliver's message of "Tue, 29 Mar 2005 22:12:25 GMT")

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	other threads:[~2005-03-30  0:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-29 22:12 insert date/time gooliver
2005-03-30  0:09 ` Miles Bader [this message]
     [not found] ` <mailman.585.1112142448.28103.help-gnu-emacs@gnu.org>
2005-03-30 10:57   ` gooliver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hdiuq9j0.fsf@tc-1-100.kawasaki.gol.ne.jp \
    --to=miles@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).