Please enable JavaScript to view this site.

A-Shell Development History

XTREE editable date and time fields can use the Windows date/time picker control for editing, instead of the standard edit control. You can enable and configure the new editing method via one or both of the following:

InfDef=D   (in conjunction with a D column, i.e. date)

InfDef=t   (in conjunction with an h column, i.e. time)

For example:

Coldef = "1~8~Date~DE~InfDef=D~~"

You can make the date option by specifying the "O" (optional) code in your InfDef string, i.e. InfDef=DO. (Note that the InfDef clause is shared by all columns, so this method forces you to treat all editable date and time columns the same way.)

In the above example, since the column width is 8, the format will be set to MM/DD/YY (or DD/MM/YY depending on the LDF). Otherwise the year would be returned in CCYY format.

The other method for activating or configuring the date/time picker control is to specify a new advanced coldef parameter:

Format=<format string>

This clause is local to the column, and so does allow you different date editing options for different 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

 

 

 

For example:

Coldef = "1~15~Date/Time~DE~Format=dd/MM/yyy HH:mm~~"

The contents of that column should then look something like this:

08/15/2009 13:21

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.)

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.)