Here's some code to do the sorting - it assumes the corrected version of your example, that you are using inactive timestamps for the values of the
EVENT_CREATED property for each header and that every top-level node contains an
(defun ndk/get-key ()
(org-time-string-to-seconds (substring (org-entry-get (point) "EVENT_CREATED") 1 -1)))
(defun ndk/cmp (t1 t2)
(< t1 t2))
(defun ndk/org-sort-entries ()
(org-sort-entries nil ?f #'ndk/get-key #'ndk/cmp))
You can add these function definitions to your init file, or load them from a file or evaluate them in your
To use them, select the region that you want to sort in the usual way and say
This sorts in ascending order. If you want descending order, change the
?F in the definition of
nkd/org-sort-entries. For more details, see the doc string for
C-h f org-sort-entries RET.
ndk/get-key function is called at the beginning of each entry. It retrieves the value of the property, strips the initial and final square brackets and converts the string to a UNIX time in seconds (since the "epoch", 1970-01-01 00:00:00).
the convention of using inactive timestamps for the values of the
EVENT_CREATED property allows the use of the already existing Org mode function
org-time-string-to-seconds to convert to a float that can be easily used in comparisons when sorting.
the convention also allows easy entry of the property value:
C-c C-x p asks you for the property name (and probably already has
EVENT_CREATED filled in, so all you have to do is press RET here) and then asks you for the property value, which you can enter with
C-c ! RET to give it an inactive timestamp with the current date. This has nothing to do with the sorting, but it is one reason that I recommended you use inactive timestamps as values in the first place.