|
Hi all,
I am in the challenging effort to put together a time zone check for users using a global application originally written in PHP.
Sadly, it seems I struck at a point to I am trying to gather some help in these forums.
Problem is the following:
the server saves time zone information in the user profile, and it will keep a value of the difference between the Users time and the Server time.
Assuming the Server is GMT+1 and the user is GMT-7, the diff will be -8 hours.
On the other hand, if the server is GMT+1 and the user is GMT+6, the stored diff will be 5 hours.
Now to avoid typos and user problems, I want to run a small script at login that compares the user's PC time to the databases assumed time.
The problem I face: I use UNIX timestamps to store values.
I tried every single Java code I knew and also what I could find, but as soon as I want to convert the USER-SIDE date to a timestamp it will return the SERVER's time as a timestamp e.g. parse();
So:
// Get the user's time from his or her PC
d = new Date( );
If I use d.getFullYear(), d.getDate() etc. this will accurately return the user's time, e.g.
2008-Jan-25 15:20
But if I use this info and try to parse() the string, the timestamp returned will actually be the Server's time!
So, anyone has any good ideas how to solve this timezone-check riddle?
Thanks in advance.
|
|
|
|
|
|
|
// |