Tinderbox Date-type data always includes a time element, even if not explicitly set by the user. If not supplied when first set, the current OS system clock time is used for the item element - even if the date element is for a different day. Seconds are not set, or are always considered to be 00. The time element of dates makes some date comparisons work in unexpected ways.
Methods to see/check a Date's time:
- Visually in a key attribute displayed in a text window
- Exported as a string using a date formatting string that includes the time.
- Via time-specific action codes:
To set or change the time element of a date:
- Manually edit it a key attribute displayed in a text window
- Set a new Date/time via date(string)
- Set a new Date/time via date(year,month,day,hour,min)
- Via time-specific action codes:
- set just the hour element of time via Date.hour
- set just the minute element of time via Date.minute
- set the whole time element via time(theDate,hours,minutes)
When working with date designators, and explicit (24-hour clock) time can be added stated. At 14:23 on 28 November 2012:
date("today")
gives 28 November 2012 14:23
date("today - 2 days")
gives 26 November 2012 14:23
But
date("today 23:59")
gives 28 November 2012 23:59
date("today - 2 days 08:00")
gives 26 November 2012 08:00
If wanting to use greater than or less than date comparisons, it can be helpful to explicitly set a time value like 00:00 or 23:59 if wanting to test for a full day midnight-to-midnight.
Another context where (re-)setting a fixed time can be useful is with timelines and historical dates, for instance setting all times to 08:00 or some other common time, if only to avoid effectively random times set automatically when creating dates by supplying on the date and no time. Tidying up existing dates is not hard. Make an agent to find the notes needing tidying, and that add an action like:
$StartDate = time($StartDate,08,00)
Note that as the code force-changes just the hours/minutes the actual date cannot be affected. for existing data, you can run the above and delete the agent. However, if you have processes creating new events it is worth checking date designator offsets - like the examples above - also use an explicit time before you delete or turn off the agent.