Add CREATED date property to TODOs in org-mode

A more lightweight solution would be to add ! flag to the TODO state:

(setq org-todo-keywords '((sequence "TODO(!)" "DONE")))

Then:

* TODO get of your ass
  - State "TODO"    from    [2016-06-03 to. 10:35]

It isn't very pretty though.

Ref: http://orgmode.org/org.html#Tracking-TODO-state-changes


I use org-expiry to implement that functionality, which is in the contrib directory of org.

The base configuration I use is:

;; Allow automatically handing of created/expired meta data.
(require 'org-expiry)
;; Configure it a bit to my liking
(setq
  org-expiry-created-property-name "CREATED" ; Name of property when an item is created
  org-expiry-inactive-timestamps   t         ; Don't have everything in the agenda view
)

(defun mrb/insert-created-timestamp()
  "Insert a CREATED property using org-expiry.el for TODO entries"
  (org-expiry-insert-created)
  (org-back-to-heading)
  (org-end-of-line)
  (insert " ")
)

;; Whenever a TODO entry is created, I want a timestamp
;; Advice org-insert-todo-heading to insert a created timestamp using org-expiry
(defadvice org-insert-todo-heading (after mrb/created-timestamp-advice activate)
  "Insert a CREATED property using org-expiry.el for TODO entries"
  (mrb/insert-created-timestamp)
)
;; Make it active
(ad-activate 'org-insert-todo-heading)

If you are using capture it does not automatically work and needs a little glue. I have posted the complete config here: https://gist.github.com/4037694