--> Trick to change the default date Format field on Delphi | Delphi Tips Trick

For Newbie

Tuesday 15 November 2011

Trick to change the default date Format field on Delphi

| Tuesday 15 November 2011

The trick to change the default date format (mm / dd / yyyy) on record.

example:
TForm1.FormCreate procedure (Sender: TObject);
begin
   TDateField (ADOTable1.FieldByName ('SUBMIT_DATE')). DisplayFormat: = 'dd / mm / yyyy';
end;

The result you can see when the record is displayed on the DBGrid.

Another example:
var
   FDate: String [10];

TForm1.RadioButton1Click procedure (Sender: TObject);
begin
   if RadioButton1.Checked = True then FDate: = 'dd / mm / yyyy';
   if RadioButton2.Checked = True then FDate: = 'mm / dd / yyyy';
   if RadioButton3.Checked = True then FDate: = 'yyyy / mm / dd';
   TDateField (ADOTable1.FieldByName ('SUBMIT_DATE')). DisplayFormat: = FDate;
end;

Related Posts

No comments: