You are here: Building Expressions > Dates and Times > Date and Time Expressions

Date and Time Expressions

Whenever you subtract dates, times or datetime combination fields or values, the result is an elapsed difference, which may be specified as just a number of days, a time, or both, as appropriate.

For more details on working with and specifying an elapsed time, see Date, Time and Elapsed Time Constants (Literals).

Date Expressions

A date expression is an expression that uses dates in its calculations. You can use dates in your calculations to produce either another date or the number of days between dates. You can use date expressions to:

Subtract two dates to find the number of days between them.
Add a number or numeric field to a date to find the date that number of days ahead (or behind, if the adjustment is negative).
Compare two dates using any of the comparison operators such as the > (greater than) or < (less than) operators to find which date is later or earlier.

Some examples of valid date expressions are:

‘20120930‘ - ‘20120902‘ = 28 days

‘20120930‘ - ‘20090430‘ = 1249 days

‘20090430‘ > ‘20120930‘ = F

‘20120930‘ + 1 = 10/01/12 (see note below)

Note: The displayed result depends on the Date Display Format preference setting. For more information see Date Display Format .

Time Expressions

A time expression is an expression that uses times in its calculations. You can use times in your calculations to calculate elapsed times.

Some examples of valid time expressions are:

‘23:10:30‘ - ‘11:09:20‘ = ‘12:01:10‘

‘23:10:30‘ > ‘11:09:20‘ = T

‘20011231 23:10:30‘ - ‘20011219 11:09:20‘ < ‘e2/04‘ = F