General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 13th, 2002, 11:52 PM
texdc texdc is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Nashville, TN
Posts: 23 texdc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Client Date/Time + UTF offset

I'm looking for information on getting the client's date/time info, finding the UTF offset and storing that data in a mySQL database. The functionality is similar to the way forums like this keep track of a 'global time' and display date/times appropriate for each user.

How are you doing this? With JavaScript? What if the client has JS turned off? Were there any resources/tutorials, web or print, that you found helpful?

Thanks in advance!
-texdc

Reply With Quote
  #2  
Old October 20th, 2002, 12:26 AM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 7
You don't detect it, the user chooses it in his pref's. Look in your profile on use the drop down list to choose your time offset vs. gmt. Once you have their time offset, it is simple with the time() function ->

PHP Code:


That will give you the time + 2 hours. Is that what you were looking for?

EDIT:::

Is it just me, or is my PHP code not showing up?

Last edited by jpenn : October 20th, 2002 at 12:28 AM.

Reply With Quote
  #3  
Old October 20th, 2002, 12:35 AM
texdc texdc is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Nashville, TN
Posts: 23 texdc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the response. Since I posted, I've become more savvy with the date/time functions. Still, it'd be nice to be able to determine the offset automatically, that way the random visitor gets accurate local date-times for content with timestamps.

Yeah, your PHP didn't show up. I don't know why, I posted with php recently without any problems. I'll give it a try:

PHP Code:
print ("foo"); 

Reply With Quote
  #4  
Old October 20th, 2002, 02:40 PM
Joe4JC Joe4JC is offline
The name's Joe. Yours?
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Lurking in the shadows...
Posts: 147 Joe4JC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Quote:
Originally posted by jpenn
You don't detect it, the user chooses it in his pref's. Look in your profile on use the drop down list to choose your time offset vs. gmt. Once you have their time offset, it is simple with the time() function ->

PHP Code:
<?
/*
   I choose a +2 in my prefs, so it is two hours more than gmt - so
   store a +7200 in DB table
*/

$oset '7200';
$today date'M j, Y h:i'time() + $oset );
?>


That will give you the time + 2 hours. Is that what you were looking for?

EDIT:::

Is it just me, or is my PHP code not showing up?
__________________
Check out 4Life today!

Reply With Quote
  #5  
Old October 21st, 2002, 04:08 PM
texdc texdc is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Nashville, TN
Posts: 23 texdc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the code. It's similar to what I'm using and what I ment by 'date/time savvy'. It, however, grabs the time of the server, so you better know what timezone it's in. Also, it's still not automatic.

I believe it's possible to determine a visitor's timezone via their IP. However, a database that contains those relationships would have to exist and be publicly available. Anybody know of one?

Thanks again!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Client Date/Time + UTF offset


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT