Tinderbox v11 Icon

time(aDate, hoursNum, minutesNum[, secondsNum])


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Data Type Returned: 

Operator First Added: 

Operator in Current Baseline: 

Operator Last Altered: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Date-time  [other Date-time operators]

 Date [about Date data type]

 v4.0.0

 Baseline

 As at baseline


time(aDate, hoursNum, minutesNum[, secondsNum])

creates a new Date based on the aDate expression, but in which the time is set by hoursNum, minutesNum, and secondsNumDate is not changed. Only positive values are allowed. If needing to alter a Date's time towards or backwards by a certain amount, consider using interval(dataStr).

time() accepts an optional fourth argument secondsNum, representing the seconds component of the time.

For example, to make a stamp or rule that sets the time element of all event start/end dates in a timeline to 12:00:00 AM (midday) use this code:

   $StartDate=time($StartDate,12,0,0);
   if($EndDate){
      $EndDate=time($EndDate,12,0,0)
   };

Parsing of time inputs

When any/all of hoursNum, minutesNum, and secondsNumDate are provided in a value larger then their normal limit, Tinderbox adjusts the containing limit accordingly. Thus > 60 seconds adds minute to aDate, > 60 minutes adds an hour, >24 hours adds a day. Therefore:

$StartDate=time($StartDate,12,30,0); 

results in a time of 12:30:00, but:

$StartDate=time($StartDate,12,90,0); 

results in a time of 13:30:00, as 90 minutes is parsed as being 1 hour + 30 minutes and as if this code were being used:

$StartDate=time($StartDate,13,30,0); 

See also—notes linking to here: