bugnotme 0 Newbie Poster

Hi all,
I'm currently developing a java program that executes XPath 2.0 statements using the library Saxon. I have i problem doing some operations with dates.

I'm using this XML for testing purposes. As you can see the dates are in format 'YYYYMMDD', i need to retrieve the latest one and calculate the time until now (currentDate-LatestDateRetrieved):

<xml>
<date>20100215</date>
<date>20050522</fdate>
<date>20010215</date>
<date>20091231</date>
</xml>

I retrieve the latest date using the XPath function "max(//date)", but that statement returns a double that i need to parse in order to perform the date calculation ("max(//date)-currentDate()" or something similar...)

¿Do you know how to do that?

Regards.