Munez NS
Munez NS

Reputation: 1011

How does php time() function works

How does PHP time() work in following case:

User is posting something in database and posting stamp is added also which is just time().

But how to compensate for time zones? What if two users from EU and USA are posting at the same time, will the posting stamp be the same?

Upvotes: 1

Views: 611

Answers (1)

OptimusCrime
OptimusCrime

Reputation: 14863

The whole point is that the time()-method stores everything in the same timezone, the one the server is configured with.

If it did not do this, it would be impossible to know when something really happened.

If you want to display datetime with timezones, you can output the timestamp from the server, use javascript or something to calculate the clients timezone offset and add/substract hours to the time.

Upvotes: 3

Related Questions