Ver Mensaje Individual
  #9  
Antiguo 21-10-2011
Vales08 Vales08 is offline
Miembro
NULL
 
Registrado: feb 2011
Posts: 133
Reputación: 14
Vales08 Va por buen camino
Claro, lo que sucede es que yo necesito guardar fechas que correspondan a los dias lunes, en este caso trabajo con este mes, octubre.
Entonces lo que realizo primero es saber en que dia de la semana estoy ubicada hoy.. Para eso trabajo con la funcion DayOfTheWeek.

Código Delphi [-]
hoy:=DayOfTheWeek(Date)  //Toma valores 1,2,3,4,5,6,7

Hecho esto, yo pregunto lo siguiente:
Código Delphi [-]
                if  hoy=1 then   // Lunes
                  begin
                    DM.DSET_agen_turFECHA.Value:=Now; //Guardo la fecha en la tabla AGENDA
                  end;
                if  hoy=2 then   // Martes
                  begin
                    ProximaFecha:=IncDay(Date,6);
                    DM.DSET_agen_turFECHA.Value:=Proximafecha;
                  end;
                if  hoy=3 then   // Miercoles
                  begin
                    ProximaFecha:=IncDay(Date,5);
                    DM.DSET_agen_turFECHA.Value:=ProximaFecha;
                  end;
                if  hoy=4 then   // Jueves
                  begin
                    ProximaFecha:=IncDay(Date,4);
                    DM.DSET_agen_turFECHA.Value:=Proximafecha;
                  end;
                if  hoy=5 then   // Viernes   (aca estamos ubicados hoy 21/10/2011)
                  begin
                    ProximaFecha:=IncDay(Date,3);   //aca a la fecha de hoy se le suman 3 dias que son los que faltan para llegar al proximo lunes (24/10/2011)                                         
                    DM.DSET_agen_turFECHA.Value:=Proximafecha; // se guarda 24/10/2011
                  end;
                if  hoy=6 then   // Sabado
                  begin
                    ProximaFecha:=IncDay(Date,2);
                    DM.DSET_agen_turFECHA.Value:=Proximafecha;
                  end;
                if  hoy=7 then   // Domingo
                  begin
                    ProximaFecha:=IncDay(Date,1);
                    DM.DSET_agen_turFECHA.Value:=Proximafecha;
                  end;

Hasta aca me funciona barbaro, el problema es que yo no quiero que me guarde solo el lunes proximo, sino todos los del mes y eso lo quiero realizar con el FOR.. que recorre desde el dia de hoy hasta fin de mes 31/10/2011 (ultimo lunes). Para ello necesito algo que incremente la semana sino nunca voy a llegar a fin de mes..

No se si me logras entender?.
Responder Con Cita