xslt - subtracting days

前端 未结 5 1913
醉话见心
醉话见心 2020-12-15 09:26

Is it possible with xslt to take a date field and subtract N number of days from it? If so, can you please provide me an example?

5条回答
  •  旧巷少年郎
    2020-12-15 10:13

    Here is a demonstration how to do this in XSLT 2.0:

    
     
    
     
      
    
      Today is: 
      30 days ago it was: 
      365 days ago it was: 
     
    
    

    when this transformation is applied on any XML document (not used), the wanted, correct result is produced:

      Today is: 2010-10-07-07:00
      30 days ago it was: 2010-09-07-07:00
      365 days ago it was: 2009-10-07-07:00
    

提交回复
热议问题