Welcome Guest, Not a member yet? Register   Sign In
Anyone have a second for timestamp / timezone stuff?
#1

[eluser]internut[/eluser]
I'm trying to get this timestamp / timezone stuff figured out in my head.

If I'm on my locahost or even a live server which are both east coast and set my time zone to eastern my times are coming up 5 hours behind.

If i put me on "UTC" i'm fine.

Is that correct?
#2

[eluser]Colin Williams[/eluser]
So, you are saying that when you do something like

Code:
date('F d, y g:i a');

That it's 5 hours behind? This would indicate that your server is NOT eastern
#3

[eluser]TheFuzzy0ne[/eluser]
You should be able to run tzselect or tzconfig as root, and configure the timezone. It might also help to install the ntp daemon.
#4

[eluser]internut[/eluser]
Ok I think I got things figured out... Still a little confused...

I set my servers php.ini timezone to GMT.

Then I put in the timezone UM5 and get the correct time / date.

How are most servers / web hosts setup with the timezones? Do they normally use the GMT setting or run
off their local time?
#5

[eluser]TheFuzzy0ne[/eluser]
No. In my limited experience, throughout setting up Linux, the user is prompted for a location. The timezone for this location is usually used by the system.
#6

[eluser]jedd[/eluser]
[quote author="internut" date="1238796539"]How are most servers / web hosts setup with the timezones? Do they normally use the GMT setting or run off their local time?[/quote]

That's a very interesting question with a very easy, short answer, and a very long complicated one.

The easy short answer - all real operating systems (you know that by this I mean Unix and its derivatives) run with an internal clock set to GMT. Well UTC, but effectively they mean the same. And I can see [url="http://en.wikipedia.org/wiki/Time_ball"]the ball[/url] from my window, so I'm quite fond of calling it GMT.

Every action that is logged internally is done against this date. But - and here's the trick - they have an understanding of the timezone they are in, and indeed each user can nominate their own preferred timezone. This means that multiple users, from different parts of the world, can make sense of changes relative to their local timezone more easily.

Surreal operating systems (by which I mean MS products) have little concept of timezones. Try setting up AD or even MS-SQL replication across machines in different timezones .. oh my.

I digress.

So, to answer your question, servers/webhosts running GNU/Linux (the bulk of the servers you're likely to experience) will probably be configured sensibly (but it's possible they have been configured improperly by someone lacking competence or clue). Servers/webhosts running MS-something are likely to be more challenging for anyone wanting to do DATE/TIME functions, especially if they're crossing timezones.
#7

[eluser]internut[/eluser]
Very interesting...

My question is how can i correctly use the timezone option to have a timestamp show correctly for a user or even me. If my server is running off its local time and not GMT will:

$timestamp = '1238782757';
$timezone = 'UM8';
$daylight_saving = TRUE;

echo gmt_to_local($timestamp, $timezone, $daylight_saving);

work correctly? I've seen other drop downs on forums that do not show all the different areas of the world just how many hours you're ahead or behind the servers time and it shows the current time that you select for where you are.

Having a tough time wrapping myself around this Smile
#8

[eluser]internut[/eluser]
ughhhh my lordy.... I think my issues were coming from using time() and not now() to enter the timestamp into the database.

wow.




Theme © iAndrew 2016 - Forum software by © MyBB