php - How to determine UTC offset from server timezone? -
I have found a lot of examples of UTC tables and PHP methods, to change it, but I just get it After going to remember an easy way to change the server date, a user on my web page in the timezone selection.
On this page I have found a clear guide to understand the boundary, but I do not know how to join the example "Europe / Rome" on the table, if there is more about it is clear?
I know the time zone of my server (America / Chicago) but I still do not know one way to change it from the UTC method, that the user is different time zone (eg
I tried something, but I am missing something, and I do not know what it is:
& Lt ;? Php $ timezone = date ("e"); $ Date = date ('Y-M-DH: I: S'); Print $ date "- This is my server's date, and its timezone is - $ timezone
There is no way to convert UTC timezone to Europe / Rome from -13?
In all cases, like Europe / Rome is -13 or only because my server is US / UTC can be used to generate the date displayed - your server is running in the time zone . After that you can add time-time difference to the hour * 3600
with the timestamp, which you use to make a date for the user's time.
There will be a different way
A simple example would be the following for the first consideration:
& lt ;? Php $ offset = -13 * 3600; // timezone offset for UTC-13 $ UTCTime = GMDET ('MMH H: I'); $ UserTime = gmdate ('DM. YH: I', time () + offset offset); ? & Gt;
Comments
Post a Comment