SXI Forum

A place to collect usefull tips, tricks and implementation strategies.

You are not logged in.

#1 15-03-2019 13:19:36

MarekR
Member
Registered: 21-02-2019
Posts: 19

Rules: DateConverter

This rule changes the format of the given date to one you specify.

Example:

Date= “15/03/2019”

The above "Date" is in a dd/MM/yyyy format, we want to change the format to yyyy-MM-dd.

<sxi:Field name="//*[local-name()=’Date’]">
 <sxi:Rules>
    <sxi:DateConverter InputDateFormat="dd/MM/yyyy" OutputDateFormat="yyyy-MM-dd"/>
 </sxi:Rules>
 <sxi:OutputField>Date</sxi:OutputField>
</sxi:Field>

After using the above config "Date" will look as follows:

Date = "2019-03-15"

You can also use "DateConverter" for time.

To see examples of pattern syntax follow the link bellow (found at the bottom of the article):
https://www.journaldev.com/17899/java-s … ate-format

Attributes:

  • InputDateFormat:
    The format that is being used as the input.

  • OutputDateFormat:
    The format that is expected.

Offline

#2 26-03-2019 14:54:46

MarekR
Member
Registered: 21-02-2019
Posts: 19

Re: Rules: DateConverter

The "DateConverter" can also be used to input the current date in the format that you define in the "<OutputDateFormat>" attribute.

To do this however, the attribute "<InputDateFormat>" MUST be empty.

E.g

<sxi:DateConverter InputDateFormat="" OutputDateFormat="dd-MM-yyyy"/>

Last edited by MarekR (26-03-2019 14:57:35)

Offline

Board footer

Powered by FluxBB