Ver Mensaje Individual
  #4  
Antiguo 25-10-2014
Avatar de jeremiselxi
jeremiselxi jeremiselxi is offline
Miembro
 
Registrado: ago 2008
Posts: 199
Reputación: 16
jeremiselxi Va por buen camino
Cita:
Empezado por nlsgarcia Ver Mensaje
jeremiselxi,




Revisa este código:
Código Delphi [-]
...
uses DateUtils;
...
var
  fromdate, toDate : TDateTime;

begin
  // Set up our date variables
  fromDate := EncodeDateTime(2000, 02, 26, 10, 0, 0, 0);
  toDate   := EncodeDateTime(2000, 02, 29,  9, 0, 0, 0);

  // Display these dates and the days between them
  ShowMessage('From date = '+DateTimeToStr(fromDate));
  ShowMessage('To   date = '+DateTimeToStr(toDate));
  ShowMessage('Whole days difference = '+
              IntToStr(DaysBetween(toDate, fromDate))+' days');
end;
...
Tomado de DaysBetween

Revisa esta información:

Espero sea útil

Nelson.


Buenas noches Nelson.

En delphi 2009 me da error en el codigo "DaysBetween".

No se por que?


Código Delphi [-]
procedure TForm1.Button2Click(Sender: TObject);
var
fromdate, toDate : TDateTime;

begin
 // Set up our date variables
  fromDate := EncodeDate(2000, 02, 26);
  toDate   := EncodeDate(2000, 02, 29);

  // Display these dates and the days between them
  ShowMessage('From date = '+DateTimeToStr(fromDate));
  ShowMessage('To   date = '+DateTimeToStr(toDate));
  ShowMessage('Whole days difference = '+  IntToStr(DaysBetween(toDate, fromDate))+' days');

end;

end.
__________________
Cristo te ama, ven a d él, ya k te espera con los brazos abiertos. Dios te bendiga mucho
Responder Con Cita