Fix server time as user?

My server time is incorrect, it’s off by almost six hours even though I set the correct time zone. Unfortunately, I have only found entries that resulted in the server time being adjusted by the support. Is there any way for me to adjust the server time myself?

Hi there,

You can‘t change the server‘s time since you don‘t have access to it. Its time is set to the locations time where it is being hosted.

1 Like

The server time is for the entire server, so you can’t just change it.

I just checked your website’s time data with a simple test script <?php echo date("r");, and it showed the correct time to me. Where do you see the wrong time?

1 Like

I have two columns in a table in my MySQL database that default to CURRENT_TIMESTAMP. However, when I use mysqli to insert a new entry into the table, the generated timestamps, while identical, are about 5 hours and 47 or 48 minutes late. (I did however now also run your test script and it gave me the correct time, so I’m not sure what’s going on.)

This sounds like the time on the database server is wrong. You just said “my server”, which I assumed was your website server. But we host databases and websites on separate servers, which may have different time settings.

So I checked the the time on the database server assigned to your account, and it does appear to be very much off. I’ve asked iFastNet to look into this.

UPDATE: iFastNet has fixed the time on the database server.

That said, please note that the system time on the database server is set to EST, which may be different from the time zone as set on your website. You can work around this by setting the time zone on the MySQL session or by generating the timestamp from PHP before sending it to the database.

2 Likes

Thank you so much for your help! Is there no way to change the timezone for just me? Or, alternatively, select a different server that has my time zone? If not I can do the workaround, I was just hoping to not have to do that.

Sadly, that’s not possible. MySQL doesn’t have the option to set different time zones for individual users or databases. MySQL uses the time zone of the server it runs on or the timezone configured for the entire server.

So you can’t change the timezone for your database. This is true for all web hosting services.

All free hosting servers use EST. Since we mix and match web servers and database servers, having different servers in different time zones is a recipe for disaster.

1 Like

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