cloudcalculus
cloudcalculus

Reputation: 75

Last day of previous month in XSLT

Is it possible to get the last day of the previous month in XSLT? I found this function: http://www.xsltfunctions.com/xsl/functx_last-day-of-month.html but I'm not sure how to use it to get the previous month.

Upvotes: 2

Views: 3509

Answers (1)

Dimitre Novatchev
Dimitre Novatchev

Reputation: 243529

Use:

current-date()
  - xs:dayTimeDuration(concat('P', day-from-date(current-date()), 'D'))

This produces (when evaluated on any day of May 2012):

  2012-04-30-07:00

Upvotes: 4

Related Questions