UnknownPlayer Posted November 3, 2011 Share Posted November 3, 2011 I have set default time zone in php, but i have this sql statement: DELETE FROM mytable WHERE date < DATE_SUB(NOW(), INTERVAL 30 DAY); do i need to set default timezone in mysql becouse i use NOW() mysql function ? Quote Link to comment Share on other sites More sharing options...
joel24 Posted November 4, 2011 Share Posted November 4, 2011 yes you do. you need to put in the hour difference unless your mysql install is setup to accept textual timezones. $currentOffset = "+".(date("Z") / 60 / 60).":00"; //timezone mysql $update_tz = @mysql_query("SET time_zone = '$currentOffset'"); Quote Link to comment Share on other sites More sharing options...
UnknownPlayer Posted November 4, 2011 Author Share Posted November 4, 2011 But i cant use string "Europe/Belgrade" like i use in php ? Quote Link to comment Share on other sites More sharing options...
UnknownPlayer Posted November 4, 2011 Author Share Posted November 4, 2011 It works in this way, thanks.. Quote Link to comment 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.