using UTC_offset from Date
From: Jan K. (fb1.euro.net_at_home.nl)
Date: 11/30/04
- Next message: Hilarion: "Re: is there a quick way to remove non numeric chars"
- Previous message: paul: "backslashes added to quotes when reading from form"
- Next in thread: Oli Filth: "Re: using UTC_offset from Date"
- Reply: Oli Filth: "Re: using UTC_offset from Date"
- Reply: Hilarion: "Re: using UTC_offset from Date"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Nov 2004 19:32:09 +0100
I want to display a time in a fixed timezone.
A script that I am using and modifying has this code:
list($hour, $min, $sec) = preg_split ("/-/", Date("h-i-s", Time()));
This gives me three values: $hour, $min, $sec of the current time.
This is used for calculating angles for a clock on my webpage.
So far so good. The clock works fine.
But, now I want to diplay another time, not the user-time, but a fixed
UTC-time.
I've discovered that the Date Function returns a lot of values, one of those
is Z -> the UTC offset in seconds.
I have changed the code:
list($hour, $min, $sec, $utc) = preg_split ("/-/", Date("h-i-s-Z", Time()));
I hope the above will give me four values: $hour, $min, $sec and $utc .
I want to use the UTC-offset to calculate a time in a fixed timezone.
To get UTC=1 I need the following formula:
HOUR - UTC_TIMEOFFSET + 1
I have translated that in PHP-code like this:
$hour = (($hour - ($utc / 3600) + 1)
But, the script does not work. What do I do wrong?
thanks,
Jan K.
- Next message: Hilarion: "Re: is there a quick way to remove non numeric chars"
- Previous message: paul: "backslashes added to quotes when reading from form"
- Next in thread: Oli Filth: "Re: using UTC_offset from Date"
- Reply: Oli Filth: "Re: using UTC_offset from Date"
- Reply: Hilarion: "Re: using UTC_offset from Date"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]