Date and Time Operators

You can use the following operators for date, time, and dateTime data types.

Operator Description

+

Addition (use only when the second argument is a duration)

-

Subtraction (use only when the second argument is a duration)

==

Equals

!=

Not Equals

>

Greater than

>=

Greater than or Equals

<

Less than

<=

Less than or Equals

format

Returns the formatted string of date-time using the provided format picture.

+

Addition

-

Subtraction

==

Equals

Date Operators

In addition, there are some specific operators that you can use on each of date, time, and dateTime data types.

Date Operator Description

year

Returns a number representing the year component of the date-time argument.

month

Returns a number representing the month component of the date-time argument.

day

Returns a number representing the day component of the date-time argument.

Time Operators

Time Operator Description

hours

Returns a number between 0 and 23, both inclusive, representing the hours component of the date-time argument.

minutes

Returns a number between 0 and 59, both inclusive, representing the minutes component of the date-time argument.

seconds

Returns a number between 0 and 59, both inclusive, representing the seconds component of the date-time argument.

timezone

Returns an interval value, representing the time offset from UTC.

Date-Time Operators

Date-Time Operator Description

year

Returns a number representing the year component of the date-time argument.

month

Returns a number representing the month component of the date-time argument.

day

Returns a number representing the day component of the date-time argument.

hours

Returns a number between 0 and 23, both inclusive, representing the hours component of the date-time argument.

minutes

Returns a number between 0 and 59, both inclusive, representing the minutes component of the date-time argument.

seconds

Returns a number between 0 and 59, both inclusive, representing the seconds component of the date-time argument.

timezone

Returns an interval value, representing the time offset from UTC.