6

In xquery, How to get 90 days before date from a given date?

Say given date is 30-03-2012. I want to get the date which is 90 days before the given date. Leap year calculation should also not get missed.

I could not find any built in functions. There are add/substract methods, but it works only with two dates.

Any ideas?

Radhika
  • 423
  • 7
  • 22

1 Answers1

12

You need to subtract a dayTimeDuration (90 days) from a date, i.e.

xs:date("2012-03-30") - xs:dayTimeDuration("P90D")
Gunther
  • 5,146
  • 1
  • 24
  • 35