1

I need a function that can determine whether an org-time-stamp in a table equals the current date.

Example:

#+NAME: test
| date             | breakfast |
|------------------+-----------|
| <2015-11-06 Fri> | eggs      |
| <2015-11-07 Sat> | oatmel    |

I can get the timestamp from last line in above table with org-table-get-remote-range. For example:

(substring-no-properties (org-table-get-remote-range "test" "@<$1"))

Returns:

<2015-11-07 Sat>

How can I convert that string to a number so that I can compare it with something like:

(format-time-string "%Y%m%d" (current-time))?

1 Answer 1

7

You can use org-read-date to convert timestamp strings into internal times

(org-read-date nil t "<2015-11-06>" nil)

This can be compared to either (org-read-date nil t "today" nil) which always returns the current date or directly to the output of (current-time).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.