alexkidd
alexkidd

Reputation: 66

Adding Days to defined date on XSLT

im trying to add seven days from my defined day, i've a defined date like this

//n1:Invoice/cbc:IssueDate

i m using date like this and it works

<xsl:value-of select="//n1:Invoice/cbc:IssueDate" />

that turns me 20-01-2016 and i want to print seven days after this date like:

27-01-2016

any idea?

Upvotes: 2

Views: 4678

Answers (1)

Martin Vitek
Martin Vitek

Reputation: 159

I had a similar problem. I use xs:date() and xs:dayTimeDuration() to get it done.

<xsl:value-of 
     select="xs:date(
                  string-join(reverse(tokenize(//n1:Invoice/cbc:IssueDate, '-')), '-')) + 
                  xs:dayTimeDuration('P7D')"/>

would add 7 days to your value.

Note: you will need xs namespace for that (xmlns:xs="http://www.w3.org/2001/XMLSchema")

Upvotes: 4

Related Questions