If what you want is just a timestamp, you can use
(eval-when-compile (or (getenv "STRFTIME") "%Y-%m-%d %a %H:%M:%S %Z"))
"The time format for the user to set.")
(defun user-time-format (&optional insert)
"Return or insert the time string according to `user-time-format'."
(let ((str (format-time-string user-time-format)))
(if insert (insert str)
(if (called-interactively-p 'interactive) (message "%s" str) str))))
except you would set
However, your question raises an interesting issue, so let us discuss it too.
insert-dateutc is fine (but see below), but it inserts the date instead of returning it,
foo has to correct that:
(defun foo ()
(format "timestamp = [%s]" (foo))
==> "timestamp = [2015-11-18T16:37:12]"
Finally, take a look at C-h f shell-command RET. It says discourages the use of this function in lisp code, recommending
(call-process "date" nil t nil "+%Y-%m-%dT%H:%M:%S")
(buffer-substring-no-properties 1 (line-end-position 0)))