This tag <fmt: setTimeZone> Is used to set the required Time Zone Into its Scoped variable, Which can access from it’s Body. Some Attributes also been used like var, value and scope.

 

The mandatory attribute in this tag is Value that will used to display the time zone as scope variable. The other will use to as optional part as their requirements.

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<html>

<head>

       <title>&lt;fmt:setTimeZone&gt; Tag In JSTL</title>

</head>

    <body>

             <c:set var="nw" value="<%=new java.util.Date()%>" />

             <br><p><b><center>Date in Current Zone:

                   <fmt:formatDate value="${nw}" type="both"/></p></center></b>

             <p><b><center>Change Time Zone to GMT-6.30</p></center></b>

                  <fmt:setTimeZone value="GMT -6.30" />

            <p><b><center>Changed Time Zone Date & Time:

                 <fmt:formatDate value="${nw}" type="both"/></p></center></b></br>

    </body>

</html>

      JSTL Tag <fmt:setTimeZone>

In this program we just describe that how to set the time zone from current time zone Pattern First we use the JSTL Tag Lib. Then after using required attribute with the code of HTML. To represent the Time of System we call the Java Utility package for time and date in the Program. Then we use as usual required tags for complete coding.





About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.