Tinderbox Date-type data always includes a time element (hours:minutes:seconds), 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.
Use of seconds in time. Seconds are set (previously, in older releases, seconds were not set); if not set explicitly seconds are assumed to be '00'. Even if seconds are not of direct interest (but consider rounding to minutes) and not normally displayed in Displayed Attributes, it is it advisable to set a seconds value of '00' when defining time for Date-type data: that should avoid unexpected effects.
The time element of dates makes some date comparisons work in unexpected ways.
Methods to see/check a Date's time:
- Visually in a Displayed Attribute displayed in the text pane (or stand-alone note 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 Displayed Attribute displayed in the text pane (or stand-alone note 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 hours element of time via Date.hour
- set just the minutes element of time via Date.minute
- set just the seconds element of time via Date.second
- set the whole time element via time(theDate,hours,minutes,seconds)
When working with date designators, and explicit (24-hour clock) time can be added stated. At 14:23:00 on 28 November 2012:
date("today")
gives 28 November 2012 14:23:00
date("today - 2 days")
gives 26 November 2012 14:23:00
But
date("today 23:59:00")
gives 28 November 2012 23:59:00
date("today - 2 days 08:00:00")
gives 26 November 2012 08:00: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:00 or 23:59:00 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: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.
See also—notes linking to here: