Thanks Chris and John for the response.

Chris - We do not use date formats to display, but we are facing issue like
System.out.println(java.util.TimeZone.getDefault().getID()); //This prints
UTC, which is incorrect
System.out.println(System.getProperty("user.timezone")); //which prints
IST, that is correct
System.out.println(new java.util.Date().toString()); //prints Mon Feb 08
10:42:18 UTC 2016.

After restarting tomcat things get reset.
On one of the blogs I found
setting the default timezone at start time is: java -Duser.timezone=<server
time>.
I will try this.

But didn't quiet understood that why suddenly when everything works fine,
one odd day the UTC time zone starts displaying.

On Tue, Mar 22, 2016 at 8:25 PM, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Utkarsh,
>
> On 3/22/16 2:40 AM, Utkarsh Dave wrote:
> > We are having this weird issue seen in all the web application pages
> where
> > time gets changed to UTC after some days.
>
> Aren't you using DateFormats for your date/time printing?
>
> > As a workaround it works fine until Tomcat is restarted, but after some
> > days time in UTC is seen again. This is regardless of any time/time zone
> > configured on the server (IST/PST).
> > We are on linux 6.6 (with ntp running) and use java 1.7.0.95.
> > Need your thoughts on this? Let me know if you need further information
> > If i write a new java class inside tomcat directory and print the output
> to
> > one of the log files and display java.util.TimeZone.getDefault().getID().
> > it will give correct result.
> > Is some attribute within Tomcat or jsp that gets reset ?
>
> Tomcat will not attempt to change the default time zone of the JVM.
>
> How do you print timestamps in your web application? This can easily be
> corrected, but it might be a lot of work if you have been using bad
> practices.
>
> -chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to