Skip to main content

Problem:

  • Product Name: BES AppServer
  • Product Version: All
  • Product Component: Web Container/Web Server
  • Platform/OS Version: All

JSP page returns GMT time instead of the local time, so how to change it to local time?

Resolution:

As a matter of fact, BES has nothing to do with the timezone unless you set it explicitly to the Partition's VM.

Basically, it depends on the timezone setting on your Operating Systems.

In other words, if JVM can't figure out your time zone ID, it uses GMT as your default time zone (fallback value).
As you know, the default time zone ID is obtained from the user.timezone (System) property.
If the user.timezone property is not defined, it tries to get the ID using a combination of the user.country and
java.home (System) properties. Hence, first thing you want to check is your OS timezone setting (on a Unix machine that would be something like /etc/sysconfig/clock).

Also you can verify if VM properly takes the timezone info from your OS (using JDK classes like TimeZone.getDefault()).
Please note that "tzmappings" file under /jre/lib is the one VM looks at for the timezone data.

And also you may want to see if you need to consider a full-fledged resolution for your app (for internationalization etc) with the help of other classes like Locale.
Please note that it has been widely recommended in Java community to use the Calendar class in the place of the Date class.
(you may be interested to read java.util.Date gotchas @ http://mindprod.com/jgloss/gotchas.html#DATE)


Note:
If you want to explicitly set timezone for your BES Partition, you can pass as a VM parameter to your Partition. (e.g., -Duser.timezone=Asia/Calcutta)
(Please refer the following as to how to set java property for your Partition)

Old KB# 15335

#BorlandAppServer
#VisiBroker
#Security