Format DataType::Time

Hi, is there any possibility to format Tablefields (Data Type::Time) without milliseconds? I have implemented only the solution in the “OnFormat Trigger” in the form till now.

 Form::OnFormat BEGIN Text := COPYSTR(Text, 1, 5); END; 

The formatting should already in the table happens before so that the user cannot enter any milliseconds. Kind regards, Zimmer

Hi! Take a look on the FORMAT function! e.g.Text := FORMAT(TimeField, 0, '<Hours24,2>:<Minutes,2>:<Seconds,2>'); // Result: 13:02:25 Regards, Jörg

Hi, actually I don’t want to convert a TimeField to a TextField. I have a TimeField in my Table. When the user enter something in it (12:15:00), there should no seconds appear (12:15). Can I handle this in the table? Perhaps with the “AutoFormatType” and “AutoFormatExpr” Properties? Regards, Zimmer

Zimmer, it’s not possible to format the time field in the table this way, but the text field on the form does have the necessary property, simply use the FORMAT property with the following statement: <Hours24,2>:<Minutes,2> Saludos Nils

… and if you want to get rid of the seconds and milliseconds (i.e. setting them to zeroes) you can do this by applying the following code to the OnValidate trigger of you timefield (on the table): EVALUATE(MyTimeField, COPYSTR(FORMAT(MyTimeField), 1, 5));