Ver Mensaje Individual
  #1  
Antiguo 17-03-2004
Tomás Tomás is offline
Miembro
 
Registrado: may 2003
Ubicación: Elche
Posts: 140
Reputación: 22
Tomás Va por buen camino
DateTimePicker: problema comparando fechas

Hola a todos:

Al comparar dos fechas, una guardada en un registro con otra de un DateTimePicker, siendo la misma fecha no las considera iguales.

Así no funciona cuando las fechas son iguales:

rFechaPrimero := DM.IBDSContaFECHA.AsDateTime; //del registro
rFecha := DTPFecha.Date; //del DTPicker
if rFechaPrimero >= rFecha then
Application.MessageBox('La fecha debe ser mayor...','Aviso',mb_Ok+mb_IconStop);

Añadiendo StrToDate(DateToStr( )) al DTPicker si funciona:

rFechaPrimero := DM.IBDSContaFECHA.AsDateTime;
rFecha := StrToDate(DateToStr(DTPFecha.Date)); //<---¿?
if rFechaPrimero >= rFecha then
Application.MessageBox('La fecha debe ser mayor...','Aviso',mb_Ok+mb_IconStop);

¿Por qué? ¿Estoy haciendo algo mal? ¿Influirá la hora del DTPicker?

Gracias. Tomás.
Responder Con Cita