I am a novice developer trying to put together a scheduling system that
can support multiple timezones. My program is mainly in php with mySQL
backend. What I want to do is allow people to schedule an event in
their local time, and store it in gm time. Then, when other people see
the event displayed, it appears in THEIR local time. If possible, I
would also like to determine some sort of region or TZ name so I could
group users by timezone and do stuff like list all the users in a
particular region.
I've been able to get the offset from the client machine with Javascript
using:
echo "<SCRIPT LANGUAGE=\"JavaScript\">\n";
echo "var today = new Date()\n";
echo "document.writeln(today.getTimezoneOffset()/60)\n";
echo "</SCRIPT> : \n";
But I need to get the value of this into a var I can use in php. If I
could store the value in a variable, say $timeOffset, I could display
local time like:
echo date( "M d Y H:i:s",
mktime(gmdate("H")-$timeOffset,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y"))
);
How to figure out the particular region and such is totally beyond me. Any help would be greatly appreciated!