Fórum Validação de variavel do tipo TDateTime... #389644
29/10/2010
0
funtion CalculaAtrazo(dDatePgto:tDatetime):integer;
begin
if dDatePgto = StrtoDateTime(' / / ') then begin
showmessage('Data do pagamento esta em branco!')
result:= 0;
else begin
result:= date - dDatePgto;
end;
end;
Obrigado, Paulo Moraes
Paulo
Curtir tópico
+ 0Posts
29/10/2010
Wilson Junior
Espero ter colaborado.
Gostei + 0
29/10/2010
Paulo
Espero ter colaborado.
Gostei + 0
29/10/2010
Marcelo Diniz
funtion CalculaAtrazo(dDatePgto:tDatetime):integer;
begin
if dDatePgto = StrtoDateTime(' / / ') then begin
showmessage('Data do pagamento esta em branco!')
result:= 0;
else begin
result:= date - dDatePgto;
end;
end;
Obrigado,
Paulo Moraes
function ValidaData(data: string) : Boolean;
procedure TForm1.btn1Click(Sender: TObject);begin if ValidaData(edt1.Text) then MessageDlg('Data OK!', mtError, [mbOK], 0) else MessageDlg('Data Inválida!', mtError, [mbOK], 0);
end;
function TForm1.ValidaData(data: string): Boolean;var MyData : TDateTime;begintry MyData := StrToDate(data); Result := True;except on E: Exception do Result := False;end;end;
Gostei + 0
29/10/2010
Paulo
funtion CalculaAtrazo(dDatePgto:tDatetime):integer;
begin
if dDatePgto = StrtoDateTime(' / / ') then begin
showmessage('Data do pagamento esta em branco!')
result:= 0;
else begin
result:= date - dDatePgto;
end;
end;
Obrigado,
Paulo Moraes
function ValidaData(data: string) : Boolean;
procedure TForm1.btn1Click(Sender: TObject); begin if ValidaData(edt1.Text) then MessageDlg('Data OK!', mtError, [mbOK], 0) else MessageDlg('Data Inválida!', mtError, [mbOK], 0);
end;
function TForm1.ValidaData(data: string): Boolean; var MyData : TDateTime; begin try MyData := StrToDate(data); Result := True; except on E: Exception do Result := False; end; end;
Gostei + 0
29/10/2010
Compusoftware Ltda
Gostei + 0
29/10/2010
Marcelo Diniz
Gostei + 0
29/10/2010
Wilson Junior
funtion CalculaAtrazo(dDatePgto:tDatetime):integer;
begin
if dDatePgto = StrtoDateTime('30/12/1899') then begin
showmessage('Data do pagamento esta em branco!')
result:= 0;
else begin
result:= date - dDatePgto;
end;
end; Espero ter colaborado.
Gostei + 0
29/10/2010
Paulo Ricardo
function ValidaData(data: string): Boolean;
var MyData : TDateTime;
begin
try
MyData := StrToDate(data);
Result := True;
except on E: Exception do
Result := False;
end;
end;
resolve sim, creio que já foi concluido esse assunto, abs
Gostei + 0
30/10/2010
Marco Salles
Espero ter colaborado.
begin
Showmessage(
cds.FieldByName('data').AsString+sLineBreak+
datetostr(cds.FieldByName('data').AsDateTime)+sLineBreak+
floattostr(cds.FieldByName('data').AsDateTime));
end; Veja que Como nao tem nenhum Valor Vc tera depedendo do Tipo e da Conversão Um Valor Vazio ( para String) uma Data Esquisita ( Padrao nesta situaçoes ) 30/12/1899 que sera convertida para o Inteiro ZERO espero ter acrescentado algo
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)