Add or subtract the specified amount of time to the calendar, based on the calendar's rules.
1 calendar.add
<calendar.add
field='field'
value='value'
>
<calendar /> !
</calendar.add>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Afield | string | Field to be modified. | |||
Avalue | integer | Value to introduce. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Ecalendar | java.util.Calendar | Returns the modified calendar. |
Returns | |
---|---|
Type | Description |
Object | Returns the modified calendar. |
Example
Modify the calendar day. First a calendar is defined and it is obtained by screen today. Then one day is added to the same calendar and printed on the screen to see the result.
Copy
<xsql-script name='calendar_add'> <body> <set name='cal'> <calendar /> </set> <set name='mday'> <calendar.get field= "DAY_OF_MONTH"><cal/></calendar.get> </set> <println>Today : <mday/></println> <set name='tomorrow'> <calendar.get field= "DAY_OF_MONTH"><calendar.add field='DAY_OF_WEEK' value='1'><cal/></calendar.add></calendar.get> </set> <println>Tomorrow : <tomorrow/></println> </body> </xsql-script>
The result is:
Copy
Today : 22 Tomorrow : 23