Tema: Zona horaria
Ver Mensaje Individual
  #2  
Antiguo 17-04-2006
Avatar de Lepe
[Lepe] Lepe is offline
Miembro Premium
 
Registrado: may 2003
Posts: 7.424
Reputación: 28
Lepe Va por buen camino
Según acabo de ver es algo lioso el tema:
Cita:
Under legislation enacted in 1986, daylight saving time in the USA

begins at 2 a.m. on the first Sunday of April and
ends at 2 a.m. on the last Sunday of October

In most of the countries of western Europe, including the countries that are members of the EEC, daylight saving time:

begins at 1 a.m. GMT on the last Sunday of March and
ends at 1 a.m. GMT on the last Sunday of October

Daylight Saving Time - for the U.S. and its territories - is not observed in Hawaii, American Samoa, Guam, Puerto Rico, the Virgin Islands, the Eastern Time Zone portion of the State of Indiana, and by most of Arizona (with the exception of the Navajo Indian Reservation in Arizona).

In many other countries around the world, daylight saving time lasts from March 30th to October 26th.


This article from the link: http://www.timechange.com/dls/dls1.html
Extraido de http://www.thanhda.com/community/ind...;threadid=2547


Con el siguiente código sacas la fecha según los americanos, quizás tengas que adaptarla.
Código Delphi [-]

procedure TForm1.Button1Click(Sender: TObject);
var
  tzInfo: TTimeZoneInformation;
  StandardDate: TDate;
  DayLightDate: TDate;

begin
  GetTimeZoneInformation(tzInfo);

  DaylightDate := EncodeDate(
    yearof(date),
    tzInfo.DaylightDate.wMonth,
    tzInfo.DaylightDate.wDay
  );
  ShowMessage(FormatDateTime('dd-mm-yyyy',DayLightDate));



  StandardDate := EncodeDate(
    yearof(date),
    tzInfo.StandardDate.wMonth,
    tzInfo.StandardDate.wDay
  );
  ShowMessage(FormatDateTime('dd-mm-yyyy',StandardDate));

end;

Para hallar el primer domingo de un mes determinado uso esto:
Código Delphi [-]
          // si la fecha de aviso era un domingo,
          // averiguamos el primer domingo del mes de la Fecha
          DecodeDayOfWeekInMonth(FechaAviso, y, m, an, d);
          NotaActualizada := EncodeDayOfWeekInMonth(YearOf(Fecha),
            MonthOf(Fecha),
            1, // aqui el primero, si queremos el último domingo, poner un 4 o 5 (depende del mes)
            d); // dia de la semana, en este caso 7 porque es un domingo lo que buscamos
          RecodeTime(NotaActualizada, HourOf(FechaAviso),
            MinuteOf(FechaAviso),
            0, 0);

Saludos
__________________
Si usted entendió mi comentario, contácteme y gustosamente,
se lo volveré a explicar hasta que no lo entienda, Gracias.

Última edición por Lepe fecha: 17-04-2006 a las 14:41:57.
Responder Con Cita