Insert today’s date

Here’s a simple bit of code from the Emacs wiki to insert the current date. I’ve set the default to be in the format YYYY-MM-DD, but if you use a prefix C-u then you get DD-MM-YYYY.

;; from http://emacswiki.org/emacs/InsertingTodaysDate
(defun insert-todays-date (arg)
  (interactive "P")
  (insert (if arg
              (format-time-string "%d-%m-%Y")
            (format-time-string "%Y-%m-%d"))))