Using Default Formatting for Numeric, Date, and Time Fields

From RAD Studio
Jump to: navigation, search

Go Up to Setting Persistent Field Properties and Events

Delphi provides built-in display and edit format routines and intelligent default formatting for the following components:

To use these routines, you need do nothing.

Default formatting is performed by the following routines:

Field component formatting routines :

Routine Used by . . .


TFloatField, TCurrencyField


TDateField, TTimeField, TDateTimeField




TCurrencyField, TBCDField



Only format properties appropriate to the data type of a field component are available for a given component.

Default formatting conventions for date, time, currency, and numeric values are based on the Regional Settings properties in the Control Panel. For example, using the default settings for the United States, a TFloatField column with the Currency property set to True sets the DisplayFormat property for the value 1234.56 to $1234.56, while the EditFormat is 1234.56.

At design time or runtime, you can edit the DisplayFormat and EditFormat properties of a field component to override the default display settings for that field. You can also write Data.DB.TField.OnGetText and Data.DB.TField.OnSetText event handlers to do custom formatting for field components at run time.

See Also