Output All TimeZone : Parse Date « JSTL « Java Tutorial






<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%@ taglib uri="http://java.sun.com/jstl/core-rt" prefix="c-rt" %><%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<html>
  <head>
    <title>Timezones</title>
  </head>

  <body>
    <c-rt:set var="now" value="<%=new java.util.Date()%>" />

    <table border="1" width="63%" id="AutoNumber2">
      <tr>
        <td width="100%" colspan="2">
        Formatting: <fmt:formatDate value="${now}" type="both" timeStyle="long" dateStyle="long" />
        </td>
      </tr>

      <c-rt:forEach var="zone" items="<%=java.util.TimeZone.getAvailableIDs()%>">
        <tr>
          <td width="51%">
            <c:out value="${zone}" />
          </td>

          <td width="49%">
            <fmt:timeZone value="${zone}">
              <fmt:formatDate value="${now}" timeZone="${zn}"
              type="both" />
            </fmt:timeZone>
          </td>
        </tr>
      </c-rt:forEach>
    </table>
  </body>
</html>
  Download:  JSTLOutputAllTimeZone.zip( 1,225 k)








24.21.Parse Date
24.21.1.Output All TimeZone
24.21.2.Parse date input from form and format
24.21.3.Parse date from form