Ver Mensaje Individual
  #6  
Antiguo 12-09-2007
[maeyanes] maeyanes is offline
Capo de los Capos
 
Registrado: may 2003
Ubicación: Campeche, México
Posts: 2.732
Reputación: 24
maeyanes Va por buen camino
Aquí te dejo una función que recibe un año y mes cualquiera y te va mostrando los rangos de las semanas del mes:

Código Delphi [-]
procedure ShowWeekRanges(AYear, AMonth: Word);
var
  StartDay: Integer;
  DaysInMonth: Integer;
  EndDay: Integer;

begin
  StartDay := 1;
  DaysInMonth := DaysInAMonth(AYear, AMonth);
  EndDay := 8 - DayOfWeek(EncodeDate(AYear, AMonth, 1));
  repeat
    ShowMessage(Format('%d - %d', [StartDay, EndDay]));
    StartDay := EndDay + 1;
    Inc(EndDay, 7);
    if EndDay > DaysInMonth then
      EndDay := DaysInMonth
  until
    StartDay > DaysInMonth;
end;


Saludos...

Última edición por maeyanes fecha: 12-09-2007 a las 19:35:09. Razón: Modificación del código
Responder Con Cita