Thursday, 15 July 2010

Mysql, php and time differences -


I have a datetime field in mysql now () gives me 9 o'clock and UTC_TIMESTAMP () gives me 2:00 pm in the afternoon.

The real time of the client is 4:00.

There are posts that say that I should use the timestamp for TZ problems and others have to say that they want to avoid the full cost, so now I am confused.

The person who is preparing the data (which is inserted to DB) and the person (customer) who reads it, both are in the same TJ but the servers and DB are located elsewhere. Can the customer retrieve the date in its TZ?

You can use the php server time zone, mysql The server timezone and user's timezone are obviously all different.

To keep the user's original timezone, you have to save the user's time zone (depending on the location) in the database. And change it with php or mysql and show it accordingly.

I do not know what any other way to do this. This will help you change the timezone:


No comments:

Post a Comment