I am using php, and mysql. When i insert a time value into mysql database on my local host, the correct time is applied. i am using the now() function for the time.
When i insert the time values into my_sql database on my web-hosting account, it shows the wrong time zone.
if a user from a different time zone posts something, and i am viewing it in my time zone, how can i set it so the time displayed to the user is relative to where the user is viewing it from.
$sql1="INSERT INTO notifications (stamp)
VALUES (now());
Your server’s in a different time zone.
You can set the timezone in PHP and in MySQL.
And in MySQL:
Or, you can store your times as
timestampcolumns, which are always UTC in the underlying data.