How to Change TimeZone

I am from India and my current time is not matching with the Server since i am using CURRENT_TIMESTAMP in mysql to use dates and time of server but due to the time zone every time is shown as wrong if my users are from india please help me !
Thanx in advance

You cannot change the timestamp of the MySQL server.

What you can do instead is set a timezone at the beggining of your code with date_default_timezone_set('Asia/Kolkata') , then use time(); to generate the timestamp and submit that to MySQL

MySQL uses the system time zone for it’s timestamps. This system time zone is shared by all databases on the same server. That’s why we can’t change this timezone for individual databases.

What you could do is:

  • Like @anon17840020 suggested, generate the timestamps from PHP instead.
  • Use the DATETIME data type instead of TIMESTAMP. The former is timezone aware, meaning you can store timezone information, rather than just systems times.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.