busnut Posted May 2, 2009 Share Posted May 2, 2009 G'day, ive got a script on my website that displays when the mysql table was last updated, but the downside is that its 2 hours behind. For example, I updated the db (table) at 1155pm (Brisbane time), and yet it shows the db (table) was last updated at 955pm. Here is the code i'm using, and can it display the true time? $res = mysql_query("SHOW TABLE STATUS FROM database LIKE 'table'") ; echo "<tr><td colspan=2 align=center>Database Updated: ". date('l, F j, Y @ g:i a', strtotime(mysql_result($res,0,'Update_time')))."</td></tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/156530-table-status-time-incorrect/ Share on other sites More sharing options...
ignace Posted May 2, 2009 Share Posted May 2, 2009 http://dev.mysql.com/doc/refman/6.0/en/time-zone-support.html Quote Link to comment https://forums.phpfreaks.com/topic/156530-table-status-time-incorrect/#findComment-824220 Share on other sites More sharing options...
busnut Posted May 3, 2009 Author Share Posted May 3, 2009 Thanks for the link, but that has just totally confused me. To be honest, I don't even know where to begin with it. Any other suggestions...? Quote Link to comment https://forums.phpfreaks.com/topic/156530-table-status-time-incorrect/#findComment-824600 Share on other sites More sharing options...
PFMaBiSmAd Posted May 3, 2009 Share Posted May 3, 2009 If you want the server's time to be that of a specific time zone, the best way is to set the time zone that you want it to use. It would help if you showed or stated where the value was produced, but if it was produced using the mysql server functions in the query, then you should set the mysql server's time zone. If this is shared hosting, you should look at the per-connection time zone information at the link provided above - Per-connection time zones. Each client that connects has its own time zone setting, given by the session time_zone variable. Initially, the session variable takes its value from the global time_zone variable, but the client can change its own time zone with this statement: mysql> SET time_zone = timezone; You would set this immediately after every connection your script makes to the database. Quote Link to comment https://forums.phpfreaks.com/topic/156530-table-status-time-incorrect/#findComment-824604 Share on other sites More sharing options...
busnut Posted May 3, 2009 Author Share Posted May 3, 2009 The server I use is a paid server, so which means its proably shared with who knows how many other people. If it's changing the servers time, I would suspect I wouldn't be able to do that, would I? I just thought there maybe a simple process that when it displays the time using that bit of code previously supplied, that there would be a way to add 2 hours to it. I've only just gotten into mysql, so i'm still very new and quite naive about it what can be done, and how to do things. Quote Link to comment https://forums.phpfreaks.com/topic/156530-table-status-time-incorrect/#findComment-824613 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.