Subject Re: [IBO] only time in a TDBGrid
Author Helen Borrie
At 07:54 PM 26-08-02 +0000, you wrote:
>I use D3 and IBO3.
>I have a bus schedule stored in a table.
>Departures and arrivals are timestamp fields.
>When I edit the fields in a TDBTable, data appear as
>30/12/99 6.25.00
>This is unwanted.
>I'd like it to appear (and be edited) in the format hh:mm, i.e.
>6:25 (6.25 would be ok, too).
>How can I change the format a timestamp is displayed/edited in a
>TDBTable ?

See the DisplayMask and EditMask properties of TDateTimeField and TField
respectively in the Delphi help (not sure if D3 supports EditMask). If the
grid is editable, you will have to set both.

But in the VCL grid I'm not sure you could have an input field that accepts
a TDateTime through a mask that collects only the hours and minutes. You
would need to set up a format string for the mask, that always puts zeros
into the year, month, day and second slots. Masks use the same syntax as
Format(). (see the Help entry 'Format strings'.) Even so, to store the time
correctly in a TIME type (dialect 3 only) I think you might need to write
your own in-place editor or BeforePost handler, using DecodeDate and
EncodeDate, to arrive at a valid time literal...

The TDateTimePicker has a Format property but D3 might not have this control.