Format=<format string>{| <style flags>}
The Format clause provides a way to configure the behavior of the Windows Time and Date Picker control associated with an editable date and/or time column. The clause is local to the column, and thus allows different date editing options for different columns (unlike the InfDef clause, which only allows the option of activating the Time and Date Picker for all columns).
Whenever there is a Format= clause defined for an editable date or time column, the date/time picker control will be used instead of the regular edit control.
The <format string> is made up of the following special characters/fields; any other characters are treated as literals:
Symbol |
Meaning |
Symbol |
Meaning |
d |
one or two digit day |
dd |
two digit day (zero padded) |
h |
one or two digit hour in 12-hour format |
hh |
two digit hour in 12-hour format |
H |
one or two digit hour in 24-hour format |
HH |
two digit hour in 24-hour format |
m |
one or two digit minute |
mm |
two digit minute |
M |
one or two digit month number |
MM |
two digit month number |
t |
one letter AM/PM abbreviation |
tt |
two letter AM/PM |
y |
one or two digit year |
yy |
two digit year |
yyyy |
full four digit year |
|
|
The optional <style flags> (separated from the <format string> by a "|" character) may be expressed as the sum of one or more of the following options:
Symbol |
Value |
Meaning |
MCS_WEEKNUMBERS |
4 |
The month calendar displays week numbers (1-52) to the left of each row of days |
MCS_NOTODAYCIRCLE |
8 |
The month calendar does not circle today’s date |
MCS_NOTODAY |
16 |
The month calendar does not display today’s date at the bottom of the control |
MCS_NOTRAILINGDATES |
64 |
(Vista+) Dates from the previous and next months are not displayed in the current month’s calendar |
MCS_SHORTDAYSOFWEEK |
128 |
(Vistat+) Short day names are displayed in the header |
For example:
Coldef = "1~15~Date/Time~DE~Format=dd/MM/yyyy HH:mm|24~~"
The contents of that column should then look something like this:
08/15/2009 13:21
And the drop-down calendar would neither circle today’s date nor display it at the bottom of the control (due to the style flags combination of 24, i.e. 8 + 16).
Note that in columns containing both time and date, you should use the Cformat code D but not h. (Use h only when the column contains only a time.)
Note that XTREE parses the data in date cells based on the order of the day and month in the Format= clause, rather than on the local LDF setting. This should eliminate problems confusing and/or reversing the day and month when a date cell transitions between display and edit mode (since the transition requires that the cell's text contents be parsed into the sub-fields used by the date picker).
Warning: if you supply date/time data in a format that doesn't match the defined format (including blank data) OR isn't compatible with IDTIM.SBR, the date/time picker will not be able to interpret your data. In such a case, if your InfDef clause contains "O" (for optional), the date/time picker will most likely replace your bad or empty data with the current date/time. Unfortunately this limits the format flexibility otherwise provided by the Format clause. (Future enhancements may allow for some additional time/date formats, but for now you are pretty much limited to numeric date format with slash or dash delimiters. If you need more flexibility than that, stick with the regular edit mode for dates.)