
- Basic JSP Tutorial
- JSP - Home
- JSP - Overview
- JSP - Environment Setup
- JSP - Architecture
- JSP - Lifecycle
- JSP - Syntax
- JSP - Directives
- JSP - Actions
- JSP - Implicit Objects
- JSP - Client Request
- JSP - Server Response
- JSP - Http Status Codes
- JSP - Form Processing
- JSP - Writing Filters
- JSP - Cookies Handling
- JSP - Session Tracking
- JSP - File Uploading
- JSP - Handling Date
- JSP - Page Redirect
- JSP - Hits Counter
- JSP - Auto Refresh
- JSP - Sending Email
- Advanced JSP Tutorials
- JSP - Standard Tag Library
- JSP - Database Access
- JSP - XML Data
- JSP - Java Beans
- JSP - Custom Tags
- JSP - Expression Language
- JSP - Exception Handling
- JSP - Debugging
- JSP - Security
- JSP - Internationalization
- JSP Useful Resources
- JSP - Questions and Answers
- JSP - Quick Guide
- JSP - Useful Resources
- JSP - Discussion
JSTL - Core <fmt:timeZone> Tag
The <fmt:timeZone> tag is used to specify the time zone that all tags within its body will use.
Attribute
The <fmt:timeZone> tag has the following attributes −
Attribute | Description | Required | Default |
---|---|---|---|
Value | Time zone to apply to the body | Yes | None |
Example
<%@ 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> <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: <fmt:formatDate value = "${now}" type = "both" timeStyle = "long" dateStyle = "long" /> </font> </b> </p> </td> </tr> <c: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:forEach> </table> </body> </html>
The above code will generate the following result −
...........................
Formatting: 23 September 2010 15:09:09 GST
Etc/GMT+12 22-Sep-2010 23:09:09 Etc/GMT+11 23-Sep-2010 00:09:09
jsp_standard_tag_library.htm
Advertisements