0

I'm trying to set the default TimeZone in my application.

<bean id="localeResolver"class="org.springframework.web.servlet.i18n.FixedLocaleResolver">
    <property name="defaultLocale" value="en"/>
    <property name="defaultTimeZone" value="America/New_York"/>
</bean>

The defaultLocale worked but the defaultTimeZone does not look like it did, because when I instantiate a new Date I get my current TimeZone and not the one I just set.

ArunM
  • 2,274
  • 3
  • 25
  • 47
Jonas P.
  • 345
  • 1
  • 3
  • 10
  • The java Date is timezone independent.http://stackoverflow.com/questions/1516213/java-util-date-is-using-timezone – ArunM Jun 08 '15 at 05:19
  • How did you conclude that timezone is current timezone ? – ArunM Jun 08 '15 at 05:19
  • Instantiating a new date uses the default from the java version, it doesn't use the timezone set in/by the `LocaleResolver`. If you want that you need to construct it by different means. – M. Deinum Jun 08 '15 at 05:32
  • @ArunM I'm using JodaTime, so when I create a new DateTime is shows my TimeZone (-03:00) instead of NewYork (-05:00). – Jonas P. Jun 08 '15 at 13:22
  • @M.Deinum What's the easiest way to do that? – Jonas P. Jun 08 '15 at 13:25

0 Answers0