You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Guy Bashan <gu...@gmail.com> on 2009/05/28 09:40:33 UTC

[MyFaces][Core] More time Zone issue

Hi,

I have a very weird time zone issue, I am unable to understand:
I have a column that shows date according to a time zone. I get the time
zone from some bean.
Now I want to get the time zone from another bean. The time zones in both
beans are exactly the same. But I keep seeing two different dates.

This is my column (I printed there both dates):
--------------------------------------------------------------------
  <h:outputText value="#{campaign.endDate}">
    <f:convertDateTime locale="#{appBean.userLanguageLocale}"
timeZone="#{appBean.userTimeZone}" type="both" />
  </h:outputText>
  <h:outputText value="<br/>" escape="false" />
  <h:outputText value="#{campaign.endDate}">
    <f:convertDateTime locale="#{appBean.userLanguageLocale}"
timeZone="#{campaign.timeZoneObj}" type="both" />
  </h:outputText>
  <h:outputText value="<br/>" escape="false" />
  <h:outputText value="#{appBean.userTimeZone == campaign.timeZoneObj}" />
  <h:outputText value="<br/>" escape="false" />
  <h:outputText value="#{appBean.userTimeZone}" />
  <h:outputText value="<br/>" escape="false" />
  <h:outputText value="#{campaign.timeZoneObj}" />

The output on all column looks something like this:
--------------------------------------------------------------------------
Jul 10, 2009 10:00:00 PM
Jul 10, 2009 1:00:00 PM
true
sun.util.calendar.ZoneInfo[id="Asia/Tokyo",offset=32400000,dstSavings=0,useDaylight=false,transitions=10,lastRule=null]
sun.util.calendar.ZoneInfo[id="Asia/Tokyo",offset=32400000,dstSavings=0,useDaylight=false,transitions=10,lastRule=null]
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
As you can notice, both TimeZones are exactly the same, but I get 2
different dates.
One thing I noticed, that when I changed: f:convertDateTime to
s:convertDateTime I got NullPointerException telling me that TimeZone is
null. I think this may imply on the problem, although I see no reason for
time zone to be null (as can be seen from the output...)

Thanks,
Guy.