Tinderbox v9 Icon

Checking and setting Time correctly in Date data

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:

To set or change the time element of a date:

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


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.