Hi Chris Here is the output for each of your procedure.
java TimeZoneTest output user.timezone= TimeZone.getDefault=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null] TZ=Asia/Calcutta java TimeZoneTest output user.timezone= TimeZone.getDefault=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null] java -Duser.timezone=Asia/Calcutta TimeZoneTest Output user.timezone=Asia/Calcutta TimeZone.getDefault=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null] TZ=IST java TimeZoneTest Output user.timezone= TimeZone.getDefault=sun.util.calendar.ZoneInfo[id="IST",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null] The timezone in our linux server is uniformly configured in multiple methods. Output of /etc/sysconfig/clock ZONE="Asia/Calcutta" UTC=true ARC=false via TZ environment variable Via /etc/localtime Output of /etc/localtime ÊÛ°ÌqÌ2¨ÒtRÐ[hMX [h HMTBURTISTTZif2ÿÿÿÿV¶(ÿÿÿÿÊÛ°ÿÿÿÿÌqÿÿÿÿÌ2¨ÿÿÿÿÒtLMTHMTBURTIST IST-5:30 I am saying JDK is running in correct timezone because all the sample application ran in system timezone. I am saying Tomcat is running in GMT timezone because logs, web apps are all outputs in GMT Timezone. One vital information i forgot to provide previously is, Tomcat timezone is correct till "Tomcat server startup in Ns" message. Regards On Sat, Oct 10, 2009 at 6:52 PM, Christopher Schultz < ch...@christopherschultz.net> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Raghu, > > On 10/10/2009 4:04 AM, raghu gs wrote: > > I have installed Tomcat 6.0.20 using binary tarball in JDK 1.6.0.16 > running > > CentOS 5,3 x64 Server. > > Use this class for reference: > > import java.util.TimeZone; > > public class TimeZoneTest > { > public static void main(String[] args) > { > System.out.println("user.timezone=" > + System.getProperty("user.timezone")); > System.out.println("TimeZone.getDefault=" > + TimeZone.getDefault()); > } > } > > On my system, this is the output with all defaults: > > $ java TimeZoneTest > user.timezone= > > TimeZone.getDefault=sun.util.calendar.ZoneInfo[id="America/New_York",offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/New_York,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]] > > > We have tried the following methods to force tomcat to use the > Asia/Calcutta > > as timezone. > > > > 1) Created an environment variable called TZ and assigned it correct > > timezone. > > $ TZ=Asia/Calcutta java TimeZoneTest > user.timezone= > > TimeZone.getDefault=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null] > > > 2) Setting the correct timezone in catalina.sh via JAVA_OPTS="$JAVA_OPTS > > -Duser.timezone=Asia/Calcutta" > > $ java -Duser.timezone=Asia/Calcutta TimeZoneTest > user.timezone=Asia/Calcutta > > TimeZone.getDefault=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null] > > > 3) Our linux server uses Asia/Calcutta as Timezone, > > evidence clock command's output is Sat 10 Oct 2009 01:18:44 PM IST > > -0.502713 seconds > > What configuration effects this timezone setting? TZ environment > variable? Something else? > > > 4) We have tried setting IST as timezone in catalina.sh too. but it > didn't > > work. > > $ TZ=IST java TimeZoneTest > user.timezone= > > TimeZone.getDefault=sun.util.calendar.ZoneInfo[id="IST",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null] > > > 5) Java runtime is correctly running in Asia/Calcutta time, as a simple > java > > program revealed it. > > Good. > > > We have certainly not forced to use GMT as timezone in our tomcat > > webapps code, as the same code is shared between multiple servers, In > > those servers timezone information is being correctly inherited. > > What does your server report if you ask for > System.getProperty("user.timezone") and TimeZone.getDefault() while > Tomcat is running? What leads you to believe that either the JVM or > "Tomcat" is not running with the right TimeZone? > > > Please help me to resolve this issue else i have to reformat the hard > disk. > > That seems like a drastic technique. > > - -chris > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAkrQiqwACgkQ9CaO5/Lv0PD9ewCfZLn3mzh66g0xgifCwR0WRRrl > btcAn1Wuk0u5WKnxxpeala8NxSiC+oDK > =Fg2p > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >