IBM Forms: Date formats

The XFDL Compute "date()" returns "yyyymmdd".

The default XForms Date field format is "yyyy-mm-dd".

The XForms Date picker seems to understands either "yyyymmdd" or "yyyy-mm-dd" for prepopulation, but will save the date as "yyyy-mm-dd" by default.

Note, however, that Xpath functions only understand "yyyy-mm-dd".  So if you have a constraint or compute in a bind -- for instance, making sure the start date is before the end date -- and one or more of the fields used by the xPath is prepopulated as a date, then you have to use "yyyy-mm-dd" or the xPath won't work properly.

As well, it is best to prepopulate it as "yyyy-mm-dd" as otherwise your back end code can get confused:  If the date is changed it will be saved as "yyyy-mm-dd" where as if the date is not changed the prepopulated value will not be changed (even if it is in "yyyymmdd".)  So any back-end processing could recieve either format.

Avoid these problems by always prepopulating dates for xForm date fields in the format "yyyy-mm-dd".

No feedback yet