I am new to Xforms and need help setting the default date in nodeset binding. I need to set the default date to be current date + 30 days. How do I do this?
A:
Figured it out. In the binding, I set the default for the date to days-to-date(days-from-date(local-date()) + 30). But this does not set the time though. And my field is of type xs:datetime.
Purni
2010-06-07 20:26:13
+1
A:
If you want the result to be an xs:dateTime
, then the following will do the trick:
current-dateTime() + xs:dayTimeDuration('P30D')
Alessandro Vernet
2010-06-08 21:28:24
I still need the date to be current date + 30 days. And display it with the time. Your suggestion shows only current-dateTime() + the time.
Purni
2010-06-09 16:42:38
@Purni, it looks like I misunderstood what you are looking for. My suggestion shows current time + 30 days. What is it that you are looking for?
Alessandro Vernet
2010-06-09 18:40:49
@Alessandro, I have a date time picker on my xform of type xs:dateTime. In binding, I need to set the default for this field to be current date + 30 days. days-to-date(days-from-date(local-date()) + 30) does this. But the problem is it sets only the date and not the time. I need it to set the dateTime in ISO dateTime. format.
Purni
2010-06-09 20:14:21
@Purni, OK, but doesn't initializing the node with `current-dateTime() + xs:dayTimeDuration('P30D')` do that? It will put in the node the current date-time + 30 days, in the ISO dateTime format.
Alessandro Vernet
2010-06-09 20:28:35
@Alessandro - I tried that yesterday and got an error. I guess I had a typo. I tried it just now and that totally works! Thanks!
Purni
2010-06-10 17:13:12
@Purni, great, I'm glad this helped.
Alessandro Vernet
2010-06-10 19:46:25
@Alessandro, the solution you gave gives me the time with milliseconds. Could you please help by giving me the solution without the milliseconds?
Purni
2010-08-30 18:39:14