Usa esta unidad:
Código Delphi
[-]
unit lpDates;
interface
uses sysutils, dateutils, Controls, windows;
function InicioVeranoSpain(Year:Word):TDateTime; function FinVeranoSpain(Year:Word):TDateTime;
type THorario = (hInvalida, hVerano,hDesconocida, hInvierno);
function EstamosEnhorarioVerano(const TheDate:TDateTime):THorario;
implementation
function InicioVeranoSpain(Year:Word):TDateTime; var Week:Word;
begin
Result:= EncodeDateTime(Year, 1, 1,23,59,59,999);
Week := 6;
while not TryEncodeDayOfWeekInMonth(Year,
3, Week, 7, Result)
do
Dec(Week);
Result := RecodeTime(Result,2,0,0,0);
function FinVeranoSpain(Year:Word):TDateTime; var Week:Word;
begin
Result:= EncodeDateTime(Year, 1, 1,23,59,59,999);
Week := 6;
while not TryEncodeDayOfWeekInMonth(Year,
10, Week, 7, Result)
do
Dec(Week);
Result := RecodeTime(Result ,3,0,0,0); end;
function EstamosEnhorarioVerano(const TheDate:TDateTime):THorario;
var ValidStart, ValidFinish:TDateTime;
begin
ValidStart := RecodeTime(InicioVeranoSpain(yearof(TheDate)),0,0,0,0);
if (TheDate > InicioVeranoSpain(yearof(TheDate))) and (TheDate < ValidStart) then
begin
Result := hInvalida;
end
else
begin
ValidFinish := RecodeTime(FinVeranoSpain(yearof(TheDate)), 2,0,0,0);
if (TheDate >= ValidStart) and (TheDate < ValidFinish) then
Result := hVerano
else if (TheDate > ValidFinish) and (TheDate < FinVeranoSpain(yearof(thedate))) then
Result := hDesconocida
else
Result:= hInvierno;
end;
end;
end.
No sé de donde pillé las rutinas, yo lo modifiqué un poco.
Saludos