Search
ctrl/
Ask AI
Light
Dark
System

Operators

Subtopics

Date and time types support the addition or subtraction of various durations. Note that this operation produces a result of the same type as the operand before the operator:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input
Input
Run
Output Objects
Press the 'Run' button to evaluate the input
Input
Run
Output Objects
Press the 'Run' button to evaluate the input
Input
Run
Output Objects
Press the 'Run' button to evaluate the input

Of course, durations can be added and subtracted from each other:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input
Input
Run
Output Objects
Press the 'Run' button to evaluate the input

When different kinds of durations are mixed the result is a relative_duration:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input
Input
Run
Output Objects
Press the 'Run' button to evaluate the input

Finally, it's possible to subtract one datetime value from another to get a duration:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

When calculating the difference between two local_datetime or local_time values the result is a relative_duration:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

When subtracting one local_date from another the result is a date_duration:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input