Link to home
Start Free TrialLog in
Avatar of fbk2000
fbk2000

asked on

Raw Date to String

How to I change a raw date string:   '123908.123129387' (for instance) to a readable string   '01/05/2006'?
ASKER CERTIFIED SOLUTION
Avatar of Jacco
Jacco
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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