[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 05-08-2006, 09:38 PM   #1 (permalink)
JYM
Senior Member
 
JYM's Avatar
 
Join Date: Sep 2005
Location: San Diego, California
Posts: 1,078
87.41 NP$ (Donate)

JYM is a glorious beacon of lightJYM is a glorious beacon of lightJYM is a glorious beacon of lightJYM is a glorious beacon of lightJYM is a glorious beacon of light


Time Zone Question

Hi

I have a mysql database which has dates and times in it, which is displayed on my website.

Is there a way to grab the user's local machine, determine the time offset, then apply it so that all the dates on the site are according to the timezone?

This will probably require javascript or php, and I know for SURE that it works in Flash because in the actionscript i typed in a few lines and it displayed the local machine time. When I changed my computer's time, it would change in the flash file.
__________________
Ipzy.com - Free Proxy to visit Myspace/Facebook, Tech News, and more!
Onlineness.com - Free Proxy
FOR SALE: support.im | tradepile.com
JYM is offline  
Old 05-09-2006, 11:07 AM   #2 (permalink)
NamePros Member
 
Join Date: Apr 2005
Posts: 116
134.00 NP$ (Donate)

mikesherov will become famous soon enoughmikesherov will become famous soon enough


the reason why the flash displays the right time is because the value you are displaying IS the local time (which in flash and javascript use the machine local time because they are apps whihc run on your computer... javascript and flash are client side programs).

However, PHP has no access to your local machine because it's a preprocessor... all code is run before being sent to the local machine, i.e. server side.

You could use IP to location technology to determine the user's timezone, than transform the dates based on the timezone difference. Be careful to watch out for locations that don't observe Daylight Savings Time!
mikesherov is offline  
Old 05-09-2006, 03:26 PM   #3 (permalink)
JYM
Senior Member
 
JYM's Avatar
 
Join Date: Sep 2005
Location: San Diego, California
Posts: 1,078
87.41 NP$ (Donate)

JYM is a glorious beacon of lightJYM is a glorious beacon of lightJYM is a glorious beacon of lightJYM is a glorious beacon of lightJYM is a glorious beacon of light


So is there a way to capture the time on the local machine, send it to the server, then have the server process it and change it accordingly so all the dates/times display correctly to that user?

Then..say..do this to each individual user (1000s...).
__________________
Ipzy.com - Free Proxy to visit Myspace/Facebook, Tech News, and more!
Onlineness.com - Free Proxy
FOR SALE: support.im | tradepile.com
JYM is offline  
Old 05-09-2006, 04:56 PM   #4 (permalink)
NamePros Regular
 
Jim_'s Avatar
 
Join Date: Aug 2005
Posts: 585
285.40 NP$ (Donate)

Jim_ is a name known to allJim_ is a name known to allJim_ is a name known to allJim_ is a name known to allJim_ is a name known to allJim_ is a name known to all

Save The Children
if the user doesn't have the cookie set {
use javascript to determine user's timezone, set it into cookie, then reload page
} else {
read cookie for user's timezone and display corrected time
}
__________________
ask me about the internet
Jim_ is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 11:15 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85