javatimezonetimezone-offsetjstl-functions

JSTL timezone (KST) implementation error found


While I practicing JSTL timeZone tag, I tried to run these two actions:

<c:set var="now" value="<%= new java.util.Date() %>" />
<fmt:timeZone value="GMT+9:00">
    <fmt:formatDate value="${now}" type="both"
                    dateStyle="full" timeStyle="full"/>
</fmt:timeZone>
<%-- and --%>
<fmt:timeZone value="KST">
    <fmt:formatDate value="${now}" type="both"
                    dateStyle="full" timeStyle="full"/>
</fmt:timeZone>

I believe they should produce same result. However, they produce following two different time values.

2017년 8월 15일 화요일 오후(PM) 8시 03분 27초 GMT+09:00

2017년 8월 15일 화요일 오전(AM) 11시 03분 27초 GMT

Did I miss something or the implementation is incorrect? I case of mis-implementation, who should I contact?


Solution

  • It's not recommended to use three-letter time zone IDs. They are deprecated. And not all of them are supported.

    See oracle java docs

    Three-letter time zone IDs

    For compatibility with JDK 1.1.x, some other three-letter time zone IDs (such as "PST", "CTT", "AST") are also supported. However, their use is deprecated because the same abbreviation is often used for multiple time zones (for example, "CST" could be U.S. "Central Standard Time" and "China Standard Time"), and the Java platform can then only recognize one of them.