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

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

Re: printing file last-modify date and time


From: Deniz Dogan
Subject: Re: printing file last-modify date and time
Date: Sat, 5 Feb 2011 03:26:45 +0100

2011/2/5 O <mondifero@gmail.com>:
>
> Hi all,
>
> I'd like to write a command that prints the last-modify date and time
> of the file open in the current buffer, in the format: 20110204-1920
> (for 7:20pm on 4 feb 2011).  Suggestions?
>

(defun insert-modification-time ()
  (interactive "*")
  (if buffer-file-name
      (insert
       (format-time-string
        "%Y%m%d-%H%M"
        (nth 5 (file-attributes buffer-file-name))))
    (message "No file associated with buffer.")))


-- 
Deniz Dogan



reply via email to

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