OK - I feel pretty dumb asking such a basic question, but hey.
I am trying to get the current time in a different time zone in Java webapp. I tried the following obvious solution: in my servlet
Calendar localCalendar = Calendar.getInstance(myBean.getTimeZone());
then I pass the calendar object through the JSP as the request attribute "localCalendar":
It is now: [${requestScope.localCalendar.time}]
in TimeZone ${requestScope.localCalendar.timeZone.ID}
but my conclusion seems to ignore the set of time zones, i.e.
It is now: [Thu Nov 26 10:01:03 GMT 2009] in TimeZone Indian/Mahe
I assume this has something to do with the Locale settings, is there a way to get the time formatted for my Locale in a different time zone?
source
share