Hola a todos...
Hoy mi duda es concisa..
Necesito saber si se puede realizar un for con fechas o datos de tipo tDateTime..
Lo que yo quiero realizar es un for que va desde la fecha actual (Now) hasta el ultimo dia del mes (UltimoDia), donde la fecha actual se va incrementando hasta llegar a Ultimodia.
Código Delphi
[-]
var
Proximafecha, UltimoDia, DiaActual:TdateTime;
hoy:integer;
dia, mes, anio: Word;
...
hoy:=DayOfTheWeek(Date); DecodeDate(Now, anio, mes, dia);
UltimoDia:=RecodeDate(Date, anio, mes, DaysInMonth(Now));
for Proximafecha:=Now to UltimoDia do
begin
if hoy=1 then begin
DM.DSET_agen_turFECHA.Value:=Now; end;
if hoy=2 then begin
ProximaFecha:=IncDay(Date,6);
DM.DSET_agen_turFECHA.Value:=Proximafecha;
end;
if hoy=3 then begin
ProximaFecha:=IncDay(Date,5);
DM.DSET_agen_turFECHA.Value:=ProximaFecha;
end;
if hoy=4 then begin
ProximaFecha:=IncDay(Date,4);
DM.DSET_agen_turFECHA.Value:=Proximafecha;
end;
Ami me salta el siguiente error al realizar el codigo en la linea (**):
Cita:
[Error] Form_registro_dia_hora.pas(1016): For loop control variable must have ordinal type
|
A mi entender dice que la variable para este tipo de bucle debe ser ordinal.
Trabajo con delphi 7, firebird y sql manager..
Espero su ayuda, Desde ya muchas gracias..