""> "" />
Easy Tutorial
❮ Jsp Javabean Jstl Function Substringbefore ❯

<fmt:timeZone> Tag

JSP Standard Tag Library

The <fmt:timeZone> tag is used to specify the time zone for other tags to use.


Syntax

&lt;fmt:setLocale value="<string>" variant="<string>" scope="<string>"/>

Attributes

The <fmt:timeZone> tag has the following attributes:

Attribute Description Required Default Value
value Time zone Yes None

Example

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ 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>JSTL fmt:timeZone Tag</title>
  </head>

  <body>
    &lt;c:set var="now" value="<%=new java.util.Date()%>" />
    <table border="1" width="100%">
      <tr>
        <td width="100%" colspan="2" bgcolor="#0000FF">
          <p align="center">
            <b>
              <font color="#FFFFFF" size="4">Formatting:
              &lt;fmt:formatDate value="${now}" type="both"
              timeStyle="long" dateStyle="long" />
              </font>
            </b>
          </p>
        </td>
      </tr>

      &lt;c:forEach var="zone"
      items="<%=java.util.TimeZone.getAvailableIDs()%>">
        <tr>
          <td width="51%">
            &lt;c:out value="${zone}" />
          </td>
          <td width="49%">
            &lt;fmt:timeZone value="${zone}">
              &lt;fmt:formatDate value="${now}" timeZone="${zn}"
              type="both" />
            </fmt:timeZone>
          </td>
        </tr>
      </c:forEach>
    </table>
  </body>
</html>

The output is as follows:


JSP Standard Tag Library

❮ Jsp Javabean Jstl Function Substringbefore ❯