Re: Pointing tomcat to a different timezone

2012-07-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Konstantin,

On 7/29/12 9:21 PM, Konstantin Kolinko wrote:
 When you are saying that it is still in UTC, what data are
 you looking at?
 
 
 You have not answered the above question. It might be that the
 date you are looking at explicitly uses the UTC timezone.

Also, Tomcat doesn't really care what time zone you are in. It's best
to think of all times are being time-zone-less and then apply a time
zone merely for output purposes.

Unfortunately, lots of the Java date and time APIs have some hidden
time zone stuff. For instance, java.util.Date has a timezone offset
that I believe gets set to the JVM's native timezone offset (UTC in
your case?) but you can't change it. So, when you want to do anything
with java.util.Date, you have to adjust for that.

Likewise, java.text.SimpleDateFormat contains a time zone which
defaults to the JVM's timezone, but does not have a constructor that
accepts a time zone. So, you need to set the time zone through a
separate method before doing anything with SimpleDateFormat.

Of course, Sun/Oracle have deprecated pretty much all of the
java.util.Date API in favor of java.util.Calendar, but then completely
failed to support Calendar with DateFormat and java.sql.*.

Just wait: JSR 310 promises to solve all of these problems by
providing a new API similar to Jodatime that will probably end up
failing us all miserably.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlAW07QACgkQ9CaO5/Lv0PCt6QCff6Ts+fonxw81pZK/1Ib6wrOe
mRYAn3hdzIYznmly+vNwjUG9zVz6bw1b
=Cote
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Pointing tomcat to a different timezone

2012-07-30 Thread Krishna Chaitanya
This issue is fixed. Thanks everyone :-)

Krishna Kurnala.

On Jul 30, 2012, at 11:34 AM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Konstantin,
 
 On 7/29/12 9:21 PM, Konstantin Kolinko wrote:
 When you are saying that it is still in UTC, what data are
 you looking at?
 
 
 You have not answered the above question. It might be that the
 date you are looking at explicitly uses the UTC timezone.
 
 Also, Tomcat doesn't really care what time zone you are in. It's best
 to think of all times are being time-zone-less and then apply a time
 zone merely for output purposes.
 
 Unfortunately, lots of the Java date and time APIs have some hidden
 time zone stuff. For instance, java.util.Date has a timezone offset
 that I believe gets set to the JVM's native timezone offset (UTC in
 your case?) but you can't change it. So, when you want to do anything
 with java.util.Date, you have to adjust for that.
 
 Likewise, java.text.SimpleDateFormat contains a time zone which
 defaults to the JVM's timezone, but does not have a constructor that
 accepts a time zone. So, you need to set the time zone through a
 separate method before doing anything with SimpleDateFormat.
 
 Of course, Sun/Oracle have deprecated pretty much all of the
 java.util.Date API in favor of java.util.Calendar, but then completely
 failed to support Calendar with DateFormat and java.sql.*.
 
 Just wait: JSR 310 promises to solve all of these problems by
 providing a new API similar to Jodatime that will probably end up
 failing us all miserably.
 
 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
 Comment: GPGTools - http://gpgtools.org
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iEYEARECAAYFAlAW07QACgkQ9CaO5/Lv0PCt6QCff6Ts+fonxw81pZK/1Ib6wrOe
 mRYAn3hdzIYznmly+vNwjUG9zVz6bw1b
 =Cote
 -END PGP SIGNATURE-
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Pointing tomcat to a different timezone

2012-07-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Krishna,

On 7/30/12 3:20 PM, Krishna Chaitanya wrote:
 This issue is fixed. Thanks everyone :-)

Would you like to contribute back to the community (especially the
archives) ad tell us what you did to solve your issue?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlAXLMUACgkQ9CaO5/Lv0PCfCgCeMVC7o6qqBkcTlRXQlChFyEcR
kUsAmgIJ2eO14q/Q8vlwfGEfstjoay0z
=oeAU
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Pointing tomcat to a different timezone

2012-07-29 Thread krishna chaitanya kurnala
Dear Tomcat Users,

I am deploying a Java Application in Tomcat, that is picking the wrong
Time-zone from OS. I did try to change the time settings at OS level.

while the OS is PDT
[root@sdc-cidev10 ~]# date
Sun Jul 29 15:16:41 PDT 2012

My Java App is still in Universal Time-zone. Can you please guide me on how
to set -Duser.timezone property for Tomcat?

Thanks in advance,
Krishna Chaitanya


Re: Pointing tomcat to a different timezone

2012-07-29 Thread Igor Cicimov
On Mon, Jul 30, 2012 at 8:39 AM, krishna chaitanya kurnala kkc...@gmail.com
 wrote:

 Dear Tomcat Users,

 I am deploying a Java Application in Tomcat, that is picking the wrong
 Time-zone from OS. I did try to change the time settings at OS level.

 while the OS is PDT
 [root@sdc-cidev10 ~]# date
 Sun Jul 29 15:16:41 PDT 2012

 My Java App is still in Universal Time-zone. Can you please guide me on how
 to set -Duser.timezone property for Tomcat?

 Thanks in advance,
 Krishna Chaitanya


Can't you just use the TimeZone class in your app?

String timeZoneId = Australia/Sydney;
TimeZone timeZone = TimeZone.getTimeZone(timeZoneId);


Is this Sun Oracle Java? Do you have the tzdata package installed?


Re: Pointing tomcat to a different timezone

2012-07-29 Thread krishna chaitanya kurnala
Hello Igor

Thanks for your response :)
Request some more info to get started ..
Yes, I am using sun jdk 1.6 ... how do i verify installation of tzdata
package?

thanks,
Krishna Chaitanya


On Sun, Jul 29, 2012 at 5:19 PM, Igor Cicimov icici...@gmail.com wrote:

 On Mon, Jul 30, 2012 at 8:39 AM, krishna chaitanya kurnala 
 kkc...@gmail.com
  wrote:

  Dear Tomcat Users,
 
  I am deploying a Java Application in Tomcat, that is picking the wrong
  Time-zone from OS. I did try to change the time settings at OS level.
 
  while the OS is PDT
  [root@sdc-cidev10 ~]# date
  Sun Jul 29 15:16:41 PDT 2012
 
  My Java App is still in Universal Time-zone. Can you please guide me on
 how
  to set -Duser.timezone property for Tomcat?
 
  Thanks in advance,
  Krishna Chaitanya
 

 Can't you just use the TimeZone class in your app?

 String timeZoneId = Australia/Sydney;
 TimeZone timeZone = TimeZone.getTimeZone(timeZoneId);


 Is this Sun Oracle Java? Do you have the tzdata package installed?



Re: Pointing tomcat to a different timezone

2012-07-29 Thread Konstantin Kolinko
2012/7/30 krishna chaitanya kurnala kkc...@gmail.com:
 Dear Tomcat Users,

 I am deploying a Java Application in Tomcat, that is picking the wrong
 Time-zone from OS. I did try to change the time settings at OS level.

 while the OS is PDT
 [root@sdc-cidev10 ~]# date
 Sun Jul 29 15:16:41 PDT 2012


I suspect that you changed the timezone not for the OS, but for the
root user only.

Effectively you changed some shell environment variable. It may be
different for different users. So you have to look at the user that
actually starts Tomcat java process.

How to configure it depends on what version of Tomcat you are using
and on how it is installed.

Do not forget to restart Tomcat after the change.



 My Java App is still in Universal Time-zone. Can you please guide me on how
 to set -Duser.timezone property for Tomcat?

When you are saying that it is still in UTC, what data are you looking at?

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Pointing tomcat to a different timezone

2012-07-29 Thread krishna chaitanya kurnala
Hello Konstantin

I verified the timezone is same for both users:
[jenkinspan@sdc-cidev10 ~]$ date
Sun Jul 29 17:31:27 PDT 2012
[jenkinspan@sdc-cidev10 ~]$ sudo su - root
[root@sdc-cidev10 ~]# date
Sun Jul 29 17:31:39 PDT 2012

We are using  apache-tomcat-6.0.33  I didnot do anything special but,
untar and ./startup.sh from bin folder.

Can you please guide me based on this info?

thanks,
Krishna Chaitanya


On Sun, Jul 29, 2012 at 5:25 PM, Konstantin Kolinko
knst.koli...@gmail.comwrote:

 2012/7/30 krishna chaitanya kurnala kkc...@gmail.com:
  Dear Tomcat Users,
 
  I am deploying a Java Application in Tomcat, that is picking the wrong
  Time-zone from OS. I did try to change the time settings at OS level.
 
  while the OS is PDT
  [root@sdc-cidev10 ~]# date
  Sun Jul 29 15:16:41 PDT 2012


 I suspect that you changed the timezone not for the OS, but for the
 root user only.

 Effectively you changed some shell environment variable. It may be
 different for different users. So you have to look at the user that
 actually starts Tomcat java process.

 How to configure it depends on what version of Tomcat you are using
 and on how it is installed.

 Do not forget to restart Tomcat after the change.


 
  My Java App is still in Universal Time-zone. Can you please guide me on
 how
  to set -Duser.timezone property for Tomcat?

 When you are saying that it is still in UTC, what data are you looking
 at?

 Best regards,
 Konstantin Kolinko

 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




Re: Pointing tomcat to a different timezone

2012-07-29 Thread Konstantin Kolinko
2012/7/30 krishna chaitanya kurnala kkc...@gmail.com:
 Hello Konstantin

 I verified the timezone is same for both users:
 [jenkinspan@sdc-cidev10 ~]$ date
 Sun Jul 29 17:31:27 PDT 2012
 [jenkinspan@sdc-cidev10 ~]$ sudo su - root
 [root@sdc-cidev10 ~]# date
 Sun Jul 29 17:31:39 PDT 2012

 We are using  apache-tomcat-6.0.33  I didnot do anything special but,
 untar and ./startup.sh from bin folder.

 Can you please guide me based on this info?

 thanks,
 Krishna Chaitanya


 On Sun, Jul 29, 2012 at 5:25 PM, Konstantin Kolinko
 knst.koli...@gmail.comwrote:

 2012/7/30 krishna chaitanya kurnala kkc...@gmail.com:
  Dear Tomcat Users,
 
  I am deploying a Java Application in Tomcat, that is picking the wrong
  Time-zone from OS. I did try to change the time settings at OS level.
 
  while the OS is PDT
  [root@sdc-cidev10 ~]# date
  Sun Jul 29 15:16:41 PDT 2012


 I suspect that you changed the timezone not for the OS, but for the
 root user only.

 Effectively you changed some shell environment variable. It may be
 different for different users. So you have to look at the user that
 actually starts Tomcat java process.

 How to configure it depends on what version of Tomcat you are using
 and on how it is installed.

 Do not forget to restart Tomcat after the change.


 
  My Java App is still in Universal Time-zone. Can you please guide me on
 how
  to set -Duser.timezone property for Tomcat?


Create file  bin/setenv.sh and add the following line there:

export TZ=America/Los_Angeles
or
export TZ=/usr/share/zoneinfo/America/Los_Angeles


 When you are saying that it is still in UTC, what data are you looking
 at?


You have not answered the above question. It might be that the date
you are looking at explicitly uses the UTC timezone.

Also please write your replies below the text you are replying to.

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Pointing tomcat to a different timezone

2012-07-29 Thread krishna chaitanya kurnala
This Works ;-)
Thanks a lot Konstantin. Appreciate it :)

Krishna Chaitanya


On Sun, Jul 29, 2012 at 6:21 PM, Konstantin Kolinko
knst.koli...@gmail.comwrote:

 2012/7/30 krishna chaitanya kurnala kkc...@gmail.com:
  Hello Konstantin
 
  I verified the timezone is same for both users:
  [jenkinspan@sdc-cidev10 ~]$ date
  Sun Jul 29 17:31:27 PDT 2012
  [jenkinspan@sdc-cidev10 ~]$ sudo su - root
  [root@sdc-cidev10 ~]# date
  Sun Jul 29 17:31:39 PDT 2012
 
  We are using  apache-tomcat-6.0.33  I didnot do anything special but,
  untar and ./startup.sh from bin folder.
 
  Can you please guide me based on this info?
 
  thanks,
  Krishna Chaitanya
 
 
  On Sun, Jul 29, 2012 at 5:25 PM, Konstantin Kolinko
  knst.koli...@gmail.comwrote:
 
  2012/7/30 krishna chaitanya kurnala kkc...@gmail.com:
   Dear Tomcat Users,
  
   I am deploying a Java Application in Tomcat, that is picking the wrong
   Time-zone from OS. I did try to change the time settings at OS level.
  
   while the OS is PDT
   [root@sdc-cidev10 ~]# date
   Sun Jul 29 15:16:41 PDT 2012
 
 
  I suspect that you changed the timezone not for the OS, but for the
  root user only.
 
  Effectively you changed some shell environment variable. It may be
  different for different users. So you have to look at the user that
  actually starts Tomcat java process.
 
  How to configure it depends on what version of Tomcat you are using
  and on how it is installed.
 
  Do not forget to restart Tomcat after the change.
 
 
  
   My Java App is still in Universal Time-zone. Can you please guide me
 on
  how
   to set -Duser.timezone property for Tomcat?
 

 Create file  bin/setenv.sh and add the following line there:

 export TZ=America/Los_Angeles
 or
 export TZ=/usr/share/zoneinfo/America/Los_Angeles


  When you are saying that it is still in UTC, what data are you looking
  at?
 

 You have not answered the above question. It might be that the date
 you are looking at explicitly uses the UTC timezone.

 Also please write your replies below the text you are replying to.

 Best regards,
 Konstantin Kolinko

 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org