Convert String date into date in jsp using jstl

Viewed 259

How I can convert my string date "2020-07-05 04:02:11 AM MST" into the date in JSP using JSTL. I want to convert the whole date like with timezone. when I am trying to convert it, it gives me date 07/05/20 11:02 AM GMT but in my string, the time zone is 'MST'.

<c:set var="timeZone" value="${fn:substring(txHistoryData.strTxTimeStamp, 24, 26)}" />
<fmt:parseDate value="${historyData.strTxTimeStamp}" var="txDt" timeZone="${timeZone }" pattern="yyyy-MM-dd HH:mm:ss a z" />

and I am displaying it using following code:

<span class="data-label--top"> 
  <fmt:formatDate value="${txDt}" pattern="MM/dd/yy" /> 
</span> 
<span class="data-label--bottom"> 
  <fmt:formatDate value="${txDt}" timeZone="${timeZone}" pattern="hh:mm aa z" />
</span> 

Thanks in advance.

0 Answers
Related