• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

Raw Date to String

How to I change a raw date string:   '123908.123129387' (for instance) to a readable string   '01/05/2006'?
0
fbk2000
Asked:
fbk2000
  • 2
1 Solution
 
JaccoCommented:
ShowMessage(FormatDateTime('dd/mm/yyyy hh:nn:ss:zzz', StrToFloat('123908.123129387')))

Regards Jacco
0
 
JaccoCommented:
The operation depends on the setting of the global DecimalSeparator (which is set to the Windows default set in the configuration panel). So you might have to add the following to makle it work:

procedure TForm1.Button1Click(Sender: TObject);
var
  lSav: Char;
begin
  lSav := DecimalSeparator;
  DecimalSeparator := '.';
  try
    ShowMessage(FormatDateTime('dd/mm/yyyy hh:nn:ss:zzz', StrToFloat('123908.123129387')));
  finally
    DecimalSeparator := lSav;
  end;
end;

Regards Jacco
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now