|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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:
|
|
#4
|
|||
|
|||
|
Quote:
__________________
Check out 4Life today! |
|
#5
|
|||
|
|||
|
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! |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Client Date/Time + UTF offset |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|