BIRT and Tomcat Timezone

Today, I found a problem in our report which is using BIRT. The problem is that all the datetime are using GMT time. As usual, I searched on Mr. Google and found a lot of answers such as:

  • “passing __timezone in viewer” (No, I can’t pass __timezone because I am using API rather than viewer)
  • “Set Locale”.

None of these works for me. I checked my server date and it shows correctly with GMT+8. I have already set PHP timezone also. Still when I run report, datetime is shown with GMT.

Then, I remembered that I am using Tomcat7 to show my BIRT report. But I don’t see any catalina.sh or .bashrc file in my server to edit for timezone. But then I remembered one config file (tomcat7.conf) which is located in /usr/share/tomcat7/ folder and when I VI into it, I found JAVA_OPTS there. I enable JAVA_OPTS and add “-Duser.timezone=Asia/Singapore” to it so that it looks like

JAVA_OPTS="-Duser.timezone=Asia/Singapore"

and then restart tomcat. Then my date in report shows correctly!

I am not very sure it is a healthy way to edit tomcat7.conf file but at least it works for me. :)

Also read...

Leave a Reply