java - Converting date in milliseconds to date format using JSTL -
we can convert date in milliseconds normal date format using jstl follows;
<jsp:usebean id="mydate" class="java.util.date"/> <c:set target="${mydate}" property="time" value="1365532200000"/> <p>date: ${mydate}</p>
output :
tue apr 09 18:30:00 gmt 2013
and can format "mydate" timezone="ist" follows;
<fmt:formatdate value="${mydate}" pattern="dd-mmm-yyyy hh:mm:ss z" timezone="ist"/>
consider, if have milliseconds (1377614766426) value of date in gmt 5:30 time zone(tue aug 27 20:16:06 ist 2013), how can convert millisecond value date format based on system time zone?
your date in milliseconds in utc. if change amount of milliseconds, still in utc, wrong. calculations date, use calendar. if calendar doesn't suffice, use joda time.
Comments
Post a Comment