I have a CGI program that writes a line to a log file each time it is run. On each line I want to record (amongst other things) the current date/time in the UK when the CGI program was run.
The problem is that I am in the UK and my web hosting company is in Canada, so there is a time difference. When I use the Now function, the current date/time in Canada is returned, which at present is 5 hours behind the current UK date/time.
I therefore have tried using this code to get the current UK date/time:
UKDateTime := Now + EncodeTime(5, 0, 0, 0);
This seems to work, but there are a couple of issues:
* If I change my web hosting company to a different provider in a different time zone, this will no longer work unless I change my program.
* More importantly, in the UK the clocks are put forward a hour in March and put back a hour in October. If Canada doesn't do this (or they do anything else similar throughout the year), then the UK date/time that I calculate may be wrong.
So I would like to know - what is the best way for a CGI program to obtain the current date/time in the UK (regardless of what country it is being run in)?
Thanks in Advance,