When a date passes, the system formats it and returns a String with the value of the date. It exist a correspondence with the standard type of Java java.text.SimpleDateFormat (see the link below).

1 date.format

<date.format
    format='format'
    lang='lang'
    country='country'
    timezone='timezone'
    type='type'
>
    <date /> *
</date.format>
Example

Get the current date applying an explicit string formart.

Copy
<xsql-script name='date_format_sample1'>
    <body>
        <set name='var'>
            <date.format format='dd-MM-yyyy'><date.today /></date.format>
        </set>
        <println><var /></println>
    </body>
</xsql-script>
Example

Get the current date applying the reoresentation format of user's date.

Copy
<xsql-script name='date_format_sample2'>
   <body>
       <set name='userdateformat'><system.user.getDateFormatPattern/></set>
       <set name='var'>
           <date.format format='#userdateformat'><date.today /></date.format>
       </set>
       <println><var /></println>
   </body>

</xsql-script>
Example

Application of lang and country. Difference between United Kingdom and India for the english.

Copy
<xsql-script name='dateformat_sample3'>
   <body>
       <println>
       <date.format lang='en' country='GB' type='long'>
           <date.current />
       </date.format>
       <date.format lang='en' country='IN' type='long'>
           <date.current />
       </date.format>
       </println>
   </body>

</xsql-script>
Example

Comparation between the predefined formats allowed

Copy
<xsql-script name='dateformat_sample4'>
   <body>
       <println>
       <date.format  type='short'>
           <date.current />
       </date.format>
       <date.format type='medium'>
           <date.current />
       </date.format>->
       <date.format type='long'>
           <date.current />
       </date.format>
       </println>
   </body>

</xsql-script>