timezone - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

timezone

drksprklsdrksprkls Posts: 6Member
i want my php file to return the timezone of the client rather then the server. my server is in PST and most everyone who will be accessing it will be in EST. date() only displays the time on the server.

Comments

  • tvientitvienti Posts: 230Member
    The only information you can get on the client is what their user agent gives you, which does not include timezone. You'll have to just ask them, if you need to know.

    : i want my php file to return the timezone of the client rather then the server. my server is in PST and most everyone who will be accessing it will be in EST. date() only displays the time on the server.
    :

  • drksprklsdrksprkls Posts: 6Member
    okay, what if i run a server locally, that would return the time set by that particular box right?

    : The only information you can get on the client is what their user agent gives you, which does not include timezone. You'll have to just ask them, if you need to know.
    :
    : : i want my php file to return the timezone of the client rather then the server. my server is in PST and most everyone who will be accessing it will be in EST. date() only displays the time on the server.
    : :
    :
    :

  • tvientitvienti Posts: 230Member
    I don't know if I follow for sure but... your server's going to report the time that it has set. So if your hosting your site off a server on the west coast, appropriately configured with that timezone, then any date/time functions in PHP will report in that timezone (regardless of the client's settings).

    After my last post I thought about it some more ... you COULD get the user's timezone via Javascript, assuming it's enabled. I don't know how, exactly, cause I'm a Javascript n00b, but something along the lines of having the Javascript report the client's timestamp back to the server, and doing some calculations to determine their TZ, based on difference from the server's own date.

    Reference (I didn't read through this, just a brief Google):
    http://www.willmaster.com/possibilities/archives/wmp19990831001.shtml

    T

    : okay, what if i run a server locally, that would return the time set by that particular box right?
    :
    : : The only information you can get on the client is what their user agent gives you, which does not include timezone. You'll have to just ask them, if you need to know.
    : :
    : : : i want my php file to return the timezone of the client rather then the server. my server is in PST and most everyone who will be accessing it will be in EST. date() only displays the time on the server.
    : : :
    : :
    : :
    :
    :

Sign In or Register to comment.