Topic: Time format Issue

Howdy MVD!

I am trying to change my time from military to AM/PM. Any ideas why it is not working?

'           strftime("%H:%M", A.ApptTime) As ApptTime,         '

Thanks,

scribtx

Re: Time format Issue

Can you attach your project?

@thezimguy

Re: Time format Issue

Hello.


You can change time format in a TableGrid using script

procedure Form1_TableGrid1_OnChange (Sender: TObject);
begin
     TNxTimeColumn(Form1.TableGrid1.Columns[0]).FormatMask :='HH:mm am/pm';
end;
Dmitry.

Re: Time format Issue

Drivesoft--

It is not in a table grid. It is in a text file.
Thanks,

scribtx

Re: Time format Issue

If it a text file, why you use SQL command strfime?
Please describe your case in more details.


Example, how to format time from database

procedure Form1_Button9_OnClick (Sender: TObject; var Cancel: boolean);
var
  s: string;
  time: TDateTime;
begin
    s := SQLExecute('SELECT timefield FROM person WHERE id=1');
    if s <> '' then
    begin
        time := SQLDateTimeToDateTime(s);
        s := FormatDateTime('HH:mm am/pm', time);
        ShowMessage(s);
    end;
end;
Dmitry.