MySQL Timezone

I have been using a to do list web application for the past couple of years. It’s not perfect, but it gets the job done. Well, from time to time, I stay up past midnight and am still working on my to do list. When that happens, I have to manually set the completed date, but not anymore.

I changed the timezone for the mysql session of the web app. It’s quite simple. The app uses good programming practices, so there’s only 1 place that I had to modify: immediately after the database connect & select db. These two lines now run as well:

mysql_query( 'SET time_zone = \'-8:00\'' );
date_default_timezone_set( 'America/Los_Angeles' );

My timezone is -5:00 (EST), so I set the timezone to -8:00 (PST). That gives me until 3AM local time to complete the tasks. If only there was a way to set the timezone of a particular database or user.