I am not sure why the following code works:
str is a date in the format 2011-11-04 15:54:48.38. It is a string.
When executing the following code:
<fmt:parseDate var="xxx" type="date" pattern="y-M-d H:m:s" value="${str}" />
xxx: <c:out value="${xxx}"></c:out><br />
xxx.time: <c:out value="${xxx.time}"></c:out><br />
str.time: <c:out value="${str.time}"></c:out><br />
str: <c:out value="${str}"></c:out><br />
I get this output
xxx: Fri Nov 04 15:54:48 GMT 2011
xxx.time: 1320422088038
str.time: 1320422088380
str: 2011-11-04 15:54:48.38
How is that possible? Is there any automatic conversion in place for the str.time value? How do these conversions work?
I think you’re not running the code you think you’re running. This one should definitely throw a
PropertyNotFoundExceptionon${str.time}. To naildown it, add the following line to find out what${str}actually is.It’s apparently a class which prints the given string format on
toString()and has agetTime()method.