On Sat, 2 Mar 2002, Agrawal, Anuj (Anuj)** CTR ** wrote:
> It appears that there is really not that much difference between formatDate
> and parseDate - can someone suggest when i ought to use one over the other?
>
> Also, i'm currently using an MSAccess database during development (i know i
> know.. *sigh*), and one of the fields returned by my query is a date field.
>
> When i do the following:
> <c:forEach var="someVar" begin="1" items="$myQuery.rows">
> <c:set var="myDate" value="$someVar.get('dateField')"/>
> </c:forEach>
> <fmt:formatDate value="$myDate" dateStyle="medium"/>
>
> I get the following exception:
> java.lang.IllegalArgumentException: Cannot format given Object as a Date
<fmt:formatDate> is for outputting dates; <fmt:parseDate> is for reading
(parsing) dates. That explains both the difference and the problem you're
running into.
--
Shawn Bayern
Author, "JSP Standard Tag Library" http://www.jstlbook.com
(coming this spring from Manning Publications)
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>