I’m attempting to generate a timezone in the format “GMT+01:00” based on the current server settings. None of the new timezone formulae seem to do what I want however.
The formulae must of course take account of DST, so here in the UK right now we are at GMT+01:00 and in the winter we are at GMT+00:00
Does anyone know how to write the @formula that will give me the required string on any given day of the year?
Right now, the formula @GetCurrentTimeZone is returning “Z=0$DO=1$DL=3 -1 1 10 -1 1$ZX=27$ZN=GMT”
Many thanks,
Darren.
Subject: TimeZone formulae on Windows server
I do not know if there is a clever way. I tried it by brute force, but I have not tested this much so you might find errors.
Z := @Zone(@Now);
S := @If(@Integer(Z) = 0; -1; @Sign(Z));
A := @Abs(@Integer(Z));
D := @If(Z = @Integer(Z); 0; -S);
H := @If(A > 99; @Modulo(A; 100); A);
M := @If(A > 99; @Integer(A / 100); 0);
“GMT”
+ @If(S > 0; "-"; "+")
+ @Right("0" + @Text(H + D); 2)
+ ":"
+ @Right("0" + @Text(M); 2);
Subject: RE: TimeZone formulae on Windows server
Thanks for that Rod - I didn’t expect it to be so convoluted given the new timezone based @Formula available in R6! Your formula is working well at present.
Regards,