Converting Date to American Format in Delphi

Asked

Viewed 3,755 times

0

I have the following code:

procedure Tfrmniver.FormCreate(Sender: TObject);
var hoje : tdatetime;
dia:Integer;
begin

//Defini a quantidade de dias
dia:=15;

// vamos obter a data de hoje
hoje := date;

// vamos subtrair 5 dias da data de hoje
hoje := IncDay(hoje, dia);

// vamos exibir o resultado
antecendia:=DateToStr(hoje);

//ShowMessage(antecendia);

end;

I need to convert the final result which is the antecedent variable to the American format yyyy/mm/dd because to use as query in mysql it has the date in this American format.

Someone can help me. Oh, I tried:

hoje:=FormatDateTime('yyyy/mm/dd',now);

But to no avail.

Abs

1 answer

1

already manage to solve, it was like this:

antecedencia:=FormatDateTime('yyyy/mm/dd', hoje);

Abs

Browser other questions tagged

You are not signed in. Login or sign up in order to post.