Jump to content

[SOLVED] server time


agrafuese

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.