Friday, 13 December 2013

Setting Timezone in Tomcat



You can set TZ variable in your environment by using  export TZ=GMT in your ~/.bashrc file and for tomcat with CATALINA_OPTS=-Duser.timezone=GMT (You need to edit tomcat/bin/catalina.sh file).

MySQL

For retrieving dates in another timezone from database please refer CONVERT_TZ at http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

Postgresql

Please refer http://www.postgresql.org/docs/8.0/static/datatype-datetime.html

After setting TZ kindly logout anf login again and issue the following command to check the current timezone.

echo $TZ

If its showing correct, Restart the tomcat.

Done.

No comments:

Post a Comment