cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Date Difference Formula to use in XSL Statement

satnaik18
Active Participant
0 Kudos
101

Hi Team,

We are using custom statement in our project and we need inputs on what syntax can be used for Date Difference formula in XSL statement.

Please provide your inputs on the same.

@xavierlegarrec 

Regards,

Satish Naik

View Entire Topic
surglc
Explorer

Hello @satnaik18 ,

This might work!

<xsl:template match="/dates"> <xsl:variable name="date1" select="xs:date(date1)" /> <xsl:variable name="date2" select="xs:date(date2)" /> <!-- Calculate the difference in days --> <xsl:variable name="date-diff" select="xs:date($date2) - xs:date($date1)" /> <!-- Output the difference --> <difference> <xsl:value-of select="$date-diff" /> </difference> </xsl:template>

Try adding code in a notepad++ to view in actual format and understand the code. You can probably use chatgpt as well. Try doing a preview in some testing sites like https://www.w3schools.com/xml/xml_xslt.asp

Good Luck!

Regards,

Surya