[xquery-talk] Need xquery function for "number of days between two dates"

Martin Honnen Martin.Honnen at gmx.de
Fri Apr 12 10:25:01 PDT 2013


sudheshna iyer wrote:

> I need a xquery function which takes two dates and return number of days
> that lapsed between these two dates. Input to this function can be a 2
> strings of type "mm/dd/yyyy 00:00:00".
>
> Can any of you have a function handy to do this?

Well there is an xs:dateTime data type supporting this:

days-from-duration(current-dateTime() - xs:dateTime('2013-01-01T00:00:00'))



You would first need to convert your date time format to the xs:dateTime 
format of yyyy-mm-ddThh:mm:ss respectively construct xs:dateTime values 
from your format.


More information about the talk mailing list