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 XSLT 2.0 format picture. Examples:
|
|
+ |
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. |
|
toTimezone |
Returns the date-time expressed in the time offset corresponding to the timezone ID provided. You have the following options for specifying a timezone ID:
Note: You must include double quotation marks around the timezone ID value. For more information about timezone IDs, see Class ZoneId in the Java Platform documentation. |