View Single Post
Quote:
Originally Posted by Chris182 View Post
(and if the date passes, the action is overdue)?
When exactly does the date 'pass' ?

At the stroke of midnight ? (That is certainly the conventional view … )

If so, a time component of zero (midnight) is probably what you are really thinking about – either midnight at the start of a given day or midnight at the end of that day, in which case you can just bump up the date by one day … (or use a time component of 23h and 59m)

(The underlying data in the OF database is a unix datetime field, in which the time component can be set to zero, but can not in any way be persuaded into non-existence – it's simply a number of seconds elapsed since the stroke of midnight which marked the start of January 1 2001 i.e. around 366883200 at the time of writing …)

This may give a sense of what lurks under the hood, and why there are no 'timeless' dates in this system.

Code:
#!/bin/sh
#OFOC=$(osascript -e 'tell application "Finder" to get id of application file id "OFOC"')
OFOC="com.omnigroup.OmniFocus" # For Appstore-purchased variant use (slower) line above instead
OFQUERY="sqlite3 $HOME/Library/Caches/$OFOC/OmniFocusDatabase2"
NOW=$($OFQUERY "SELECT (strftime('%s','now','localtime'))")
YEARZERO=$($OFQUERY "SELECT strftime('%s','2001-01-01')")
echo $(($NOW-$YEARZERO))
From which, where I am, I just got 366883620 seconds.

--

Last edited by RobTrew; 2012-08-16 at 11:09 PM..