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.
|