How To Add TimeZone Support To MySQL Using Perl DBI
erics, April 24th, 2011
First, make sure MySQL server has the time zone tables loaded, which are NOT there by default!
1 2 |
# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql # service mysqld restart |
Next, tell MySQL to use the desired time zone via Perl:
1 2 |
my $dbh = DBIx::SQLEngine->new( ${dsn}, '{login}', '{passwd}' ); $dbh->do_sql("SET time_zone = 'America/New_York';"); |
MySQL TimeZone Support Info MySQL Date and Time Functions