A Teradata Warehouse Miner specific function is provided for calculating the time difference between two Time, Timestamp or Integer-Time expressions (or any combination thereof) in seconds, minutes, hours or fraction of a day.
An Integer-Time expression is a six-digit integer where the first two digits represent hours, the next two digits minutes and the last two digits seconds, such as 123456, representing TIME '12:34:56'.
The date portion, however, of any Timestamp expression is ignored so that the measure is strictly the difference between two time values, assumed to be from the same day.
All the measures are based on the difference measured in seconds, with conversions to other larger units. Any differences in time zones are ignored. When dragging a Time Difference function into a variable, the following tree element is created.
Variable Creation > Input > Variables: SQL Elements pane - Date and Time > Time Difference
Columns and/or other expressions/literals that resolve to a time or timestamp can be moved over the (empty) branches of the tree.
The difference in seconds, minutes, hours and days are set through the Properties panel. Double-click on Time Difference, or highlight it and click Properties.
Variable Creation > Input > Variables: SQL Elements pane - Date and Time > Time Difference Properties
Select Seconds, Minutes, Hours or Days from the Time Field pull-down.