Bug 6436

Summary: Timezone Doesn't work when formatting a date
Product: Taglibs Reporter: Ralph Ltnn <ralph>
Component: DateTime TaglibAssignee: Tomcat Developers Mailing List <dev>
Severity: normal    
Priority: P3    
Version: 1.0B1   
Target Milestone: ---   
Hardware: PC   
OS: other   

Description Ralph Ltnn 2002-02-13 20:22:09 UTC
When using the taglib library, I'm tring to format a java.util.Date with a 
pattern as well as a timezone.  However, I can't seem to get the Timzone piece 
to work.  Here's a sample piece of code...

<dt:timeZone id="tz">myObject.getTimeZone().getID()</dt:timeZone>
<dt:format pattern="MM/dd/yy hh:mm:ss a z" timeZone="tz"

Where myObject.getTimeZone().getID() returns "MST" and
      item.getDateDue() returns a java.util.Date

Whenever I run this code, the output always shows in GMT.
Comment 1 Glenn Nielsen 2002-04-04 18:11:23 UTC
Sorry it has taken me this long to look into this.
I see a problem with your code.

<dt:timeZone id="tz">myObject.getTimeZone().getID()</dt:timeZone>

The above tries to set the time zone to the string literal
"myObject.getTimeZone().getID()" instead of its value.  If the
timezone tag is passed an invalid timezone string it uses the
system default.

Try this:

<dt:timeZone id="tz"><%= myObject.getTimeZone().getID() %></dt:timeZone>

The problem looks like it is in your code, not the taglib.