JSTL - jstl formatting setTimeZone
<prefix:setTimeZone> इस tag का इस्तेमाल timezone को variable पर store करने के लिए किया जाता है |
Syntax for <prefix:setTimeZone> tag in JSTL
<prefix:setTimeZone value = "Value" var = "variable_name" scope = "scope name" />
Attributes for <prefix:setTimeZone> tag in JSTL
value : यहाँ पर date value दी जाती है |
var : Optional. यहाँ पर variable name दिया जाता है |
scope : Optional. यहाँ पर scope दिया जाता है |
Example for <prefix:setTimeZone> Tag in JSTL
Source Code :Output :<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <c:set var="date" value="<%=new java.util.Date()%>" /> Before Changing Timezone : <fmt:formatDate value="${date}" type="both" timeStyle="long" /><br /> After Changing Timezone : <fmt:setTimeZone value = "GMT" /> <fmt:formatDate value="${date}" type="both" timeStyle="long" /><br />
Before Changing Timezone : Aug 2, 2017 8:21:07 PM IST After Changing Timezone : Aug 2, 2017 2:51:07 PM GMT