Extended rule - Converting GMT Date time into CE(S)T and Vice Versa

//Extended rule - Converting GMT Date time into CE(S)T and Vice Versa
 
datetime d1,d2,d3;
integer dMonth,dDay,tZone,dYear;
String[200] year,temp;
d1='';
d2='';
d3='';
year="";
dMonth=0;
dDay=0;
dYear=0;
tZone=0;
 
// let the date format be yyyy-mm-dd hh:mm:ss
//converting string to date format[#F is a field type is string]
 
d1=date("%Y-%m-%d %H:%M:%S", #F);
dMonth= get months (d1);
dYear= get years (d1);
ntoa(dYear,year);
 
temp=year+"-"+"03"+"-"+"31"+" 01:00:00";
d2=date("%Y-%m-%d %H:%M:%S",temp);
while(1)
do
begin
dDay=get days(d2);
if dDay=1 then break;
d2=d2<<days(-1);
end
 
temp=year+"-"+"10"+"-"+"31"+" 01:00:00";
d3=date("%Y-%m-%d %H:%M:%S",temp);
while(1)
do
begin
dDay=get days(d3);
if dDay=1 then break;
d3=d3<<days(-1);
end
 
//GMT to CE(S)T
 
if d1>d2 & d1<d3 then d1 = d1 << hours(2);
else d1 = d1 << hours(1);
 
//CE(S)T to GMT
 
//if d1>d2 & d1<d3 then d1 = d1 << hours(-2);
//else d1 = d1 << hours(-1);
 
strdate(d1,"%Y-%m-%d %H:%M:%S",#F);