I read that time() returns always timestamp that is timezone independent. But I'm confused does it always shows the same time for everyone regardless where are they from. For example right now it shows 1400706726 (Wed May 21 2014 23:12:06 GMT+0200 (Central European Daylight Time)). It is exact time as I have on my computer.
Because I need to show the same time on my website for every single user regardless which country are they from.
Does it shows the same for you. I put my script here http://www.pippion.com/test.php
time()
returns a Unix timestamp. This is the number of seconds since 00:00:00 UTC, Thursday, 1 January 1970. So yes, time()
is timezone independent. At the same time all across the world, the Unix timestamp will be the same..since they are all correlated to UTC.
However, note that this is based off of system time, so your server could be out of sync with another server. This is the same as your personal computers or smartphones..you'll notice that once you come out of airplane mode, it will take your phone a little bit to get connected to the Internet and resync its clock with the new timezone. Chances are, you've seen two pieces of technology (a phone, computer, laptop, etc) next to each other with two slightly different times (not referring to manually set clocks in microwaves, cars, etc). This is because times are synced with a network time protocol, and there are multiple ntp servers available. If your server isn't syncing with an ntp server (or if two servers use different ntp servers), it will eventually show a faulty time.
Here's what I see (just now):
2014-05-21 17:20:12
1400707212
UTC:1400707212
2014-05-21 21:20:12
Europe/Helsinki:1400707212
2014-05-22 00:20:12
Is that what you are looking for?
I am in the Central United States.