There are many occassions where you might want to find the difference in time or days between two dates. Use the PeopleCode function known as DateDiff.

 

The %DateDiff meta-SQL function returns an integer representing the difference between two dates in number of days.

Syntax:
%DateDiff(date_from, date_to)

If you would like to know the difference in minutes, you can use %DateTimeDiff

The %DateTimeDiff meta-SQL function returns a time value, representing the difference between two datetimes in minutes

Syntax:
%DateTimeDiff(datetime_from, datetime_to)