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 ? Link to comment https://forums.phpfreaks.com/topic/250404-mysql-timezone-and-php-timezone/ 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'"); Link to comment https://forums.phpfreaks.com/topic/250404-mysql-timezone-and-php-timezone/#findComment-1284856 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 ? Link to comment https://forums.phpfreaks.com/topic/250404-mysql-timezone-and-php-timezone/#findComment-1285106 Share on other sites More sharing options...
UnknownPlayer Posted November 4, 2011 Author Share Posted November 4, 2011 It works in this way, thanks.. Link to comment https://forums.phpfreaks.com/topic/250404-mysql-timezone-and-php-timezone/#findComment-1285108 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.