0

All, I want to do a date subtract operation in Xquery, OSB 12C.Basically, have to check if an input date is < 6 months from the system date.

i.e- how to do in xquery : (SystemDate - inputDate) < 6 months

Have went through: https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqdtopref.html but not able to compile any of the function listed there. Have also added the namespace in xquery. Do I need to add any library.

Any pointer is highly appreciated.

3 Answers3

0

OSB has some extensions for dates, which you can read about here.

But, you might not even need that for simple stuff like you mentioned.

Trent Bartlem
  • 2,213
  • 1
  • 13
  • 22
  • Thanks for your reply. – Rajesh Ram Oct 29 '15 at 09:38
  • I went through the link that you have mentioned above.But actually we need the year-month duration from the given date to current.whatever you are mentioned is correct only in case of taking the date/month/year portion from the given date as string/xs:date. Hope you got the query now. – Rajesh Ram Oct 29 '15 at 09:44
  • Dude I'm not going to to your job for you; going from here to a solution is 30 seconds on Google and high-school level programming skill. – Trent Bartlem Oct 29 '15 at 09:56
  • Cool dude..your answer didn't make any sound in my code. – Rajesh Ram Oct 29 '15 at 10:19
0

All, Issue got resolved.Please find the link for the logic:http://developer.marklogic.com/pipermail/general/2015-February/016462.html

0

Subtracting dates give you dayTimeDuration in XQuery.

Following code is a simple and accurate way to check time intervals.

days-from-duration(fn:current-date() - $inputDate) < 180

180 is number of days you need to validate.

Livio D.P.
  • 71
  • 5