Skip to content

Tag Archives: timezone

How to change mysql time zone

07-Nov-09

How to change mysql time zone
Edit /etc/my.cnf and change your time zone.
root@box1 [/var/lib/mysql]# cat /etc/my.cnf
[mysqld_safe]
timezone = Europe/London
~
[mysqld]
set-variable = max_connections=500
safe-show-database
Login to mysql and check the time now.
root@box1 [/var/lib/mysql]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 369
Server version: 5.0.81-community MySQL Community Edition (GPL)
~
Type ‘help;’ or ‘\h’ [...]

How to change the time zone within a php script

06-Nov-09

How to change the time zone within a php script
You can change the time zone within a php script. Here is a sample code:

You can set the timezone in .htaccess as well. Add the line:
SetEnv TZ America/Indianapolis
List of timezones is here: http://us.php.net/manual/en/timezones.php