Last day of previous month in XSLT

2019-07-20 12:45发布

问题:

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.

回答1:

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