Date and time basics in InfoPath
A D V E R T I S E M E N T
InfoPath comes with 3 date/time data types:
- Date (date)
- Time (time)
- Date and Time (dateTime)
The following table lists the corresponding internal format InfoPath uses for
each data type:
Data Type |
Internal InfoPath Format |
Date (date) |
YYYY-MM-DD |
Time (time) |
hh:mm:ss |
Date and Time (dateTime) |
YYYY-MM-DDThh:mm:ss |
InfoPath uses the Format you set on a date/time field
through the Properties dialog box of the field and the
Format... button to display dates and times. InfoPath will show
dates/times in any format you have indicated, like e.g. 9:46 P.M.,
21:46, 2/19/2006, or 19-02-2006.
Keep in mind that this is only a visual display. When InfoPath
performs validation on date and time fields, it still uses its own internal date
and time formats.
This is important to know when you want to write date and time values to
fields using code. If for example you set a field's data type to Date
(date) format and you write 2006-02-19T13:00:23 to the
field through code, you will get the following validation error:
To correct this error, change the field's data type to Date (date)
and write 2006-02-19 to the field, or change the field's data
type to Date and Time (dateTime) and write
2006-02-19T13:00:23 to the field.
|