Inserting formatted time string in Emacs

If you add the function below to your .emacs file, by invoking M-x insert-time command you can insert the current time information to your document.

(defun insert-time()
 "Insert formatted time string"
 (interactive)
 (let ((format
        (read-from-minibuffer "Format: " "%Y-%m-%d %H:%M")))
    (insert (format-time-string  format)))
)