Board index » delphi » Date conversion

Date conversion

I need some help.

With the FormatDateTime function you can make different sort of DateFormats.
You need a TDateDime format to make d.m.yy, or ddd mmm yyyy etc....

But now backwards ?

I have a d.m.yy or ddd mmm yyyy time and i wonne change that to dd-mm-yyyy.

I cann't find that routine, or isn't there annyone ?

Thanks in advance.

Bert

 

Re:Date conversion


Quote
>With the FormatDateTime function you can make different sort of
DateFormats.
>You need a TDateDime format to make d.m.yy, or ddd mmm yyyy etc....
>But now backwards ?
>I have a d.m.yy or ddd mmm yyyy time and i wonne change that to dd-mm-yyyy.

That should be easy...

From Delphi 3 help ->>>>
Description
......
FormatDateTime formats the date-and-time value given by DateTime using the
format given by Format. The following format specifiers are supported:
.........

Lookup "FormatDateTime" in your helpfile

So...

procedure TForm1.FormCreate(Sender: TObject);

var
   dt     : TDateTime;
   st     : string;

begin
   dt:=now;
   st:=FormatDateTime('d/m-yyyy',dt);
   memo1.Lines.Add(st);
end;

--
Regards
Ingolf

Re:Date conversion


Quote
"Bert Tob" <bt...@chello.nl> wrote in message

news:mbPW6.98178$s21.2070258@Flipper...

Quote

> I need some help.

> With the FormatDateTime function you can make different sort of
DateFormats.
> You need a TDateDime format to make d.m.yy, or ddd mmm yyyy etc....

> But now backwards ?

If you have a string use StrToDate, StrToDateTime, or StrToTime. Read the
help, there are some date strings that these routines cannot handle, such as
1-JUN-1905.

Other Threads