Do something like this in the jsp page:

<%-- timzone w/o dst --%>
<fmt:setTimeZone value="GMT-5" var="tz"/>
<%
        TimeZone tz = (TimeZone)pageContext.getAttribute("tz");
        SimpleTimeZone stz = new SimpleTimeZone(tz.getRawOffset(), tz.getID(), 3, 1, 
1, 7200000, 9, -1, 1, 7200000, 3600000);
        pageContext.setAttribute("stz", stz);
%>
<%-- using timezone with dst rule -->
<fmt:formatDate value="${date_time}" type="both" pattern="yyyy-MM-dd HH:mm" 
var="formated_date_time" timeZone="${stz}" />

Check Javadoc of SimpleTimeZone for DST rules in the constructor.

Howard

> -----Original Message-----
> From: Mike Deegan [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 12, 2003 1:25 PM
> To: Howard Lin
> Subject: Re: timeZone and day light saving time
> 
> 
> can you supply a listing of the code
> i'm a novice on the timezone front
> 
> tia
> mike
> 
> ----- Original Message ----- 
> From: "Howard Lin" <[EMAIL PROTECTED]>
> To: "Tag Libraries Users List" <[EMAIL PROTECTED]>
> Sent: Thursday, June 12, 2003 10:53 AM
> Subject: RE: timeZone and day light saving time
> 
> 
> I found a solution myself. Just in case anybody else wants to 
> do the same
> thing, here is what I did: create a SimpleTimeZone in a 
> script with DST
> rule, and then set this timezone in the pageContext. Then using this
> timezone in <fmt:parseDate> or <fmt:formatDate>. It works.
> 
> Howard Lin
> 
> > -----Original Message-----
> > From: Howard Lin
> > Sent: Wednesday, June 11, 2003 3:08 PM
> > To: 'Tag Libraries Users List' (E-mail)
> > Subject: timeZone and day light saving time
> >
> >
> > It seems that there is no way to specify Day Light Saving
> > Time rule in <fmt:timeZone> or <fmt:setTimeZone> since it's
> > implemented as Java TimeZone, not SimpleTimeZone. Is there
> > way to specify day light saving timezone? Thanks,
> >
> > Howard Lin
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: 
> [EMAIL PROTECTED]
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to