Date and time
What it does
The Date and Time component (fr:datetime) allows users to enter both a date and a time in a single form control.
On the desktop and mobile:
In readonly modes (such as view mode and PDF export), the component displays the combined formatted date and time as read-only text.
The value is stored in the form data in ISO 8601 format (YYYY-MM-DDTHH:mm:ss).
Basic usage
From Form Builder, insert the Date and Time control from the Date and Time section of the toolbox.
In XForms, you use the component as follows:
<fr:datetime ref="departure-time">
<xf:label>Departure Date and Time</xf:label>
</fr:datetime>Datatype
fr:datetime must be bound to a node of type xs:dateTime.
Configuration
Field width
The field-width parameter controls the width of the fields:
natural: fields take a width defined by each componentfull: fields expand to take the available width of the grid cell
This parameter can be configured in Form Builder via the Control Settings dialog, or via property:
Formats in edit mode
In edit mode, the Date and Time control delegates date and time input to the embedded Date and Time sub-controls. Each sub-control follows its own configuration:
The date field uses the date format configured for the Date control (via
oxf.xforms.xbl.fr.date.output-formatoroxf.xforms.format.input.date).The time field uses the time format configured for the Time control (via
oxf.xforms.xbl.fr.time.output-formatoroxf.xforms.format.input.time).
Formats in readonly modes
[SINCE Orbeon Forms 2026.1 and 2025.1.3]
In readonly modes (such as Form Runner view mode and PDF export), the Date and Time control formats the value as follows:
output-formatparameter: If theoutput-formatparameter is specified onfr:datetime, that format is used. You can configure this globally or per app/form via property:Or at the control level:
Combined Date and Time formats: If
output-formatis not specified onfr:datetime, the control dynamically combines the configured date format and time format, separated by a space:Date format: taken from
oxf.xforms.xbl.fr.date.output-format(falling back tooxf.xforms.format.input.date).Time format: taken from
oxf.xforms.xbl.fr.time.output-format(falling back tooxf.xforms.format.input.time).
This ensures that the format displayed in view mode and PDF matches the formats shown in edit mode.
For supported picture string tokens for dates and times, see Date output format and Time output format.
Compatibility notes
Format in readonly modes
[SINCE Orbeon Forms 2026.1 and 2025.1.3]
In earlier versions of Orbeon Forms, the Date and Time control in readonly modes did not use the date and time components' output formats. Instead, it formatted its value using the global oxf.xforms.format.output.dateTime property, which defaults to a long format (such as Wednesday January 7, 2004 04:38:35 UTC). As a result, the value in view mode often appeared in a completely different format than the one seen in edit mode.
Starting with Orbeon Forms 2026.1 and 2025.1.3:
The Date and Time control in readonly modes no longer uses the
oxf.xforms.format.output.dateTimeproperty.It now uses the combined date and time formats or the
output-formatparameter as described above.
[!WARNING] Backward Incompatibility: If you previously customized
oxf.xforms.format.output.dateTimeto format the Date and Time control in view mode or PDF, this property will no longer affectfr:datetime. To configure the readonly format:
Configure the date and time formats on the Date and Time controls using
oxf.xforms.xbl.fr.date.output-formatandoxf.xforms.xbl.fr.time.output-format(oroxf.xforms.format.input.dateandoxf.xforms.format.input.time).Or configure
output-formatonfr:datetimedirectly or viaoxf.xforms.xbl.fr.datetime.output-format.
See also
Last updated