tags:

views:

30

answers:

2

Hi,

i need to increment current date by 7 days and i'm wondering if it's possible to do that using a xpath function.

thanks !!

A: 

It is possible in XPATH 2.0. There are a number of date functions.

current-date() + xs:dayTimeDuration('P7D')
Mads Hansen
unfortunately i'm not able to use this function.
achraf
A: 

If your date is in some numeric format (CTIME, seconds since 1970 (32 bit int), or FILETIME, 100 nanosecond counts since 1601 (64 bit)) then incrementing time is easy. Just add the correct number of seconds (or 100 nanosecond intervals) to the time.

You could convert your format to CTIME via the Java time function library, add the correct number of seconds (86,400 seconds in a day), and then convert it back to your string format, I suppose. Probably not the worlds most efficient approach though.

geoffc
it's not possible because we have server restart each sunday and once restarted the timeout is reset.
achraf
@achraf: Sorry, I do not understand your point. I am suggesting you get the current time. In CTIME format. Then add 86400 seconds for each day you want to walk forward in time. Then convert that back to the format you need. You would have to redo this calc every time you need it, since the current time is different each time.
geoffc