agrafuese Posted July 7, 2008 Share Posted July 7, 2008 hey guys, i can't seem to figure out how to get my server's current date/time. i've tried time(), date(), localtime(), and some others, but it seems like everything i've tried just gives me the user's date/time. for example, my server is in California and I am also in California, so we're on PST time. if a user comes from New York, how can i make it so that they still see the PST time? right now, it is pulling their time from their ISP apparently, not their computer's time, and i know this because if i change my computer's time to say, 3 hours ahead, my website will still show my correct PST time. that's how i was mislead into thinking that my script was working in the first place it was only until someone from another timezone visited my site that i was finally aware of this issue. the php documentation on this is very confusing. any help would be much appreciated. thanks in advance! -agra Link to comment https://forums.phpfreaks.com/topic/113653-solved-server-time/ Share on other sites More sharing options...
trq Posted July 7, 2008 Share Posted July 7, 2008 PHP isn't getting its time from anywhere but your server. How do I know this? Because php runs on your server in is incapable of getting the time from your client. Link to comment https://forums.phpfreaks.com/topic/113653-solved-server-time/#findComment-584049 Share on other sites More sharing options...
DarkWater Posted July 7, 2008 Share Posted July 7, 2008 Yeah, PHP has no way of conventionally getting the client time without actually knowing their timezone and adjusting accordingly. Can I see your page? I'm from New York, so I'll tell you if it's displaying the correct PST time. Link to comment https://forums.phpfreaks.com/topic/113653-solved-server-time/#findComment-584058 Share on other sites More sharing options...
agrafuese Posted July 8, 2008 Author Share Posted July 8, 2008 hey guys, i'm so sorry. it was a mistake on my part. it turns out that this is not a php-related problem. i made a javascript clock based on the time() from php, and for some reason it's taking that time and converting it to the user's local time. so now it's a matter of fixing the JS code. certainly not a problem to discuss on this forum, haha. thanks for your time guys, and sorry for the stupidity Link to comment https://forums.phpfreaks.com/topic/113653-solved-server-time/#findComment-584087 Share on other sites More sharing options...
DarkWater Posted July 8, 2008 Share Posted July 8, 2008 Heh, no problem. Good luck with fixing it. Link to comment https://forums.phpfreaks.com/topic/113653-solved-server-time/#findComment-584088 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.