Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issues with Time Zones

Status
Not open for further replies.

mikeracicot

Technical User
Aug 28, 2002
7
US
I'm looking for a consensus of opinions on just how to deal with multiple time zones in an ecommerce site. I realize that there is a multitude of ways to do it but I would like to hear from other folks on what they encountered and how they solved this issue. Thanks in advance.
 
There really is no way to know what time zone the client is in. You don't know the physical location, nor would you know which, if any, of the 300 some odd rules with respect to Daylight savings apply.

What you can do is the have a client-side script that get the current date/time values from the clients machine and passes that back to the server.

What you then know is the current clock setting on the client's machine. As to its accuracy, and/or time zone, you can only guess. Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Ah yes, but in a proprietary system where the locations are know how would you deal with it then?
 
I have one idea. Use JavaScript's getTimezoneOffset() function.

Code:
<html>
<body>
<form action=test_tz2.php method=post name=myform>
	<input type=hidden name=userUTCoffset>
	<input type=submit>
</form>
<script>
	thedate = new Date();

	myform.userUTCoffset.value = thedate.getTimezoneOffset();
</script>
</body>
<html>
______________________________________________________________________
TANSTAAFL!
 
I wasn't really looking for any code but rather some opinions on the subject. Thanks, I'll pass it along. Mike Racicot
Ciber, Inc.
Sr. Quality Assurance Analyst
 
The problem with the solution I posted is that it depends on the time zone's begin correctly set on the client machine.

If your users will only be connecting from a known set of IP addresses, I suppose you could create a database which matches that IP address to that location's UTC offset, as well as a ruleset specifying the times and dates that location goes on and off Daylight Saving Time. You could calculate from there.

Or you could just post all times and dates in UCT and let your users figure it out. ______________________________________________________________________
TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top