Bug 8538 - fmt:parseDate is not affected by timeZone attribute
Summary: fmt:parseDate is not affected by timeZone attribute
Status: RESOLVED INVALID
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: unspecified
Hardware: Other other
: P3 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-26 01:43 UTC by Prasad Subramanian
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Prasad Subramanian 2002-04-26 01:43:45 UTC
Take this case:
  <jsp:useBean id="curDate" class="java.util.Date" />
  <fmt:setTimeZone value="GMT+5:00" var="defTZ"  />
   <fmt:timeZone value="${defTZ}">
   	Time in India (Format)<fmt:formatDate value="${curDate}" type="both" 
dateStyle="full" timeStyle="full"  /><br>
	Time in India (Format)<fmt:formatDate value="${curDate}" type="both" 
dateStyle="full" timeStyle="full" var="formatted" /><br>
	Time in India (Parse) <fmt:parseDate value="${formatted}" type="both" 
dateStyle="full" timeStyle="full" /><br>

   	
  </fmt:timeZone> 

========================================================================
The output is :
Time in India (Format)Friday, April 26, 2002 6:36:18 AM GMT+05:00
Time in India (Format)
Time in India (Parse) Thu Apr 25 18:36:18 PDT 2002

The output of parse does not reflect the timezone set.

Also in the case the timezone is explicitly set using the timeZone attribute , 
the output is in the local time zone (i.e. PDT)
Comment 1 Jan Luehe 2002-04-26 22:47:15 UTC
Note that when you parse a date string whose time is fully specified (as in your
example), the time zone included in the date string always has precedence over
the enclosing <fmt:timeZone> or 'timeZone' attribute.

Note that the parsed date is output using Date.toString(), which is why you see
"PDT" as its time zone.