I have some questions regarding time zones. We save all our date in UTC, but we need to show some of them in local (Eastern US time) and UTC at the same time.
Here is my test, I have a date in UTC and you want to display it in UTC and local time:
<html>
<jsp:useBean id="dateValue" class="java.util.Date" />
GMT
<fmt:formatDate value="${dateValue}" pattern="yyyy-MM-dd HH:mm:ss z" timeZone="GMT"/>
</html>
No time zone
<fmt:formatDate value="${dateValue}" pattern="yyyy-MM-dd HH:mm:ss z"/>
US/Eastern
<fmt:formatDate value="${dateValue}" pattern="yyyy-MM-dd HH:mm:ss z" timeZone="US/Eastern"/>
</html>
Repeat: I have UTC time from the database and you want to format it and show it in the UTC time zone. The server is running in a different time zone than UTC.
Basically, I need a function like
convertToTimezone(date, originalTimeZone, desiredTimeZone).
What fmt: formatDate provides is something like
convertToTimezone(date, serverTimeZone, desiredTimeZone).
I could hack it, but this usually causes problems while saving daylight, etc.
P.S.
, - - UTC, . , - UTC, , , , UTC. , .