Use Date em vez de Now:
procedure TForm1.Button1Click(Sender: TObject);
var myTime, myDate: TDateTime;
begin
myDate:= Date + 30;
myTime:= EncodeTime(0, 0, 0, 0);
showmessage(DateTimeToStr(myDate) + ' ' + TimeToStr(myTime));
end;
Ou poderia utilizar FormatDateTime?
Att
Steve
-Original Message-
From: delphi-br@yahoogrupos.com.br
[mailto:delphi...@yahoogrupos.com.br]on Behalf Of embarcadelphi
Sent: 03 July 2009 17:02
To: delphi-br@yahoogrupos.com.br
Subject: [delphi-br] Data e Hora de Arquivos
Boa tarde pessoal...
Estou todo enrolado no trabalho com datas e horas, conversão, etc...
Utilizei EncodeData,EncodeTime,FormatDateTime e não consigo criar uma situação
como o caso abaixo.
Tenho uma função que altera a data e a hora de um arquivo (funcionando).
vData := (Now + 30); // 30 dias após a data atual
vHora := EncodeTime(00, 00, 0, 0); // A hora DEVE ficar 00:00:00
Como faço para alocar numa variável do tipo TDateTime as duas situações acima?
Como disse no início, já tentei com diversos tipos e quando testava com um
ShowMessage(DateToStr(variavel)); não funcionava, a desgraçada da hora
mostrava SEMPRE a hora atual, é o inferno isso!
Quero que fique a data que está na variável vData e a hora que está na variável
vHora. Ambos numa só variável do tipo TDateTime.
Grato
***
This e-mail and any files transmitted with it are confidential. If you are not
the intended recipient, any reading, printing, storage, disclosure, copying or
any other action taken in respect of this e-mail is prohibited and may be
unlawful. If you are not the intended recipient, please notify the sender
immediately by using the reply function and then permanently delete what you
have received.
Content of emails received by this Trust will be subject to disclosure under
the Freedom of Information Act 2000, subject to the specified exemptions,
including the Data Protection Act 1998 and Caldicott Guardian principles.
This footnote also confirms that, unless otherwise stated, this email message
has been swept by Sophos Anti-virus for the presence of computer viruses.
***