Allows to increase or decrease some units of a date. Indicates in an arithmetic operation the unities which should be modified.

1 date.units

<date.units type='dd/d | MM/m | yy/y | HH | mm | ss'>
    <quantity /> *
</date.units>
Example

Increase days to a date.

Copy
<xsql-script name='date_units_sample1'>
    <body>
        <set name='var'>
            <add>
                <date.today /><date.units type='d'>5</date.units>
            </add>
        </set>
        <println><var /></println>
    </body>
</xsql-script>

Remarks

When the day, the month or the year increases or decreases, returns the following structure: 'yyyy-mm-dd'. The variables of 'timestamp' type mantain its original format 'yyyy-mm-dd hh-mm-ss.S'.

Example

Increase hours to a date.

Copy
<xsql-script name='date_units_sample2'>
    <body>
        <set name='var'>
            <add>
                <date.today /><date.units type='HH'>10</date.units>
            </add>
        </set>
        <println><var /></println>
    </body>
</xsql-script>

Remarks

When the day, the month or the year increases or decreases, returns the following structure: 'yyyy-mm-dd hh-mm-ss'. The variables of date type are converted automatically to 'timestamp'.

Notas

The values of the day and year can also be represented with 'y' and 'd' respectively.