Date with a default year

What is the problem? Please be detailed.

Hi. I need to set a date field with a date that it must be before the 01/01/2000 for saving time in the selection of year. Is there a way to made it?

Greetings from Guatemala

If you want an input where the date entered must before some particular date - eg 01/01/2000 - then you can put a constraint on the input, and use the decimal-date-time() function to ensure it meets your specified condition.

decimal-date-time(dateTime)

Converts dateTime value to the number of days since January 1, 1970 UTC. This is the format used by Excel.

eg

constraint = decimal-date-time(${mydate})<10957

[there are 10957 days between Jan 1 1970 and 2000].

Is that what you are after?

@Xiphware, I think you can simplify the constraint and use: . < date(01/01/2009). I haven't tried it, but it should work!

Good point. But might need . < xs:date('01/01/2000') to disambiguate from ODK date(), which wants an integer argument.