• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

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