Calculations of time differences
Sometimes the columns in a data table show different time points, but what is interesting is not the actual start and stop points. Instead you want to know how long different time periods lasted.
The examples below illustrate how time functions can be used to calculate time differences.
The data table below lists start and stop times for a number of participants in a race.
The actual time points are not important, but their results are. By entering the expression
DateDiff('Minute', [Start], [Stop])
in the Add calculated column dialog, the time differences between the start and stop times are calculated, expressed in minutes.
The DateTimeNow() function returns the current system time. For example, this can be used to, in combination with the DateDiff function described above, calculate current ages of people, if their birth dates are known.
By entering the expression
DateDiff('year', [Date of birth], DateTimeNow())
in the Add calculated column dialog, the time differences between current system time and the dates of birth are calculated, expressed in years. (Current system time when the calculation below was performed was the 31st of October, 2018.)