[SOLVED] Calculate weeknumber from a date value


Is there some simple way to calculate a Weeknumber value from a date value stored in XML?

It needs to be pure XSLT solution. I cannot use any code 🙁


If you can use EXSLT, there are several date functions available. All of them are implemented in Saxon, but if you’re using MSXSL, Chris Bayes has implemented them as extension functions, which you can actually place within your transform inside an msxsl:script element. His implementations are linked from each specific date function page.

Is week-in-year() the function you’re looking for?

Edit: Per JeniT’s comment, there’s a pure XSLT 1.0 template available on the same site with the same functionality as week-in-year() (which she wrote, I think), which might fit your requirements better.

Answered By – James Sulak

Answer Checked By – Terry (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.