Adding a date field will present your users with a group of select boxes to choose a date and/or time from.
Here's an example that displays three select boxes - year, month and date. The year select will have 2000 as the first option and always have the current year plus five years as the last option:
<field id="mydate" type="date" multiLingual="0"> <title lang="en">Date</title> <title lang="da">Dato</title> <format>Ymd</format> <year min="2000" max="+5"/> </field>
Besides the generic title elements you can provide one or two of the following elements to style and configure the date field:
Table 31. Options for configuring a date field
Element | Description |
---|---|
format | You can determine which select boxes to display in the administration, using single letter shorthands - see the table below for available shorthands. In addition to the shorthands you can use these characters to style the select boxes:
For example you can do something like this to add the time of day to the field and separate the select boxes a bit: <format>Ymd, H:i:s</format> |
year | This element must have a There is no further validity check, meaning,
that if you set |
Below is the complete list of available shorthands for select boxes:
Table 32. Options for formatting a date field
Letter | Description |
---|---|
D | Short names of days |
l (lowercase L) | Long names of days |
d | Day numbers |
M | Short names of months |
F | Long names of months |
m | Month numbers |
Y | Four digit year |
y | Two digit year |
h | 12 hour format |
H | 23 hour format |
i | Minutes |
s | Seconds |
a | am/pm |
A | AM/PM |
g | 12 hour format without leading zeroes |
W | week of the year |