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

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

Re: Inserting date into document


From: Ehud Karni
Subject: Re: Inserting date into document
Date: Mon, 25 Jun 2001 09:31:28 +0300

On Mon, 25 Jun 2001 11:31:08 +0530, Emsworth <lordemsworthx@yahoo.com> wrote:
> 
> Is it possible to insert the current date into the current buffer (even 
> it its not the diary)? If yes, then how can one manipulate its format?

Below is the code I use to insert the current time into a buffer. I
think you can use it as a basis for your needs.

Ehud.


(defvar current-date-time-format " %d/%m/%y %H:%M:%S "
  "Format of date to insert with `insert-current-date-time' func
See help of `format-time-string' for possible replacements")

(defun insert-current-date-time ()
  "insert the current date and time into current buffer.
Uses `current-date-time-format' for the formatting the date/time."
       (interactive)
       (insert (format-time-string current-date-time-format (current-time))))

(global-set-key "\C-c\C-d" 'insert-current-date-time)  ;^C^D - insert date-time


-- 
 Ehud Karni     Mivtach - Simon  Insurance   /"\
 Tel: +972-3-6212-757 Fax: +972-3-6292-544   \ /  ASCII Ribbon Campaign
 (USA) Fax and  voice  mail: 1-815-5509341    X   Against  HTML  Mail
     Better     Safe     Than     Sorry      / \
     mailto:ehud@unix.simonwiesel.co.il    http://www.simonwiesel.co.il



reply via email to

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