Nevermind - I figured it out. Thanks!

        Date thisdate = rs.getDate("date_mod");
        out.println(myFormat.format(thisdate));


Neal

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Neal Cabage
Sent: Monday, August 14, 2000 6:57 PM
To: [EMAIL PROTECTED]
Subject: [JSP-INTEREST] SQL server date Type - formatting


I have a field in my SQLServer DB that is of DateTime type.  JDBC returns
the value as: 2000-08-09 23:24:43.810

Then I need to format this as follows: 8/14/00

I was going to use:

<%
DateFormat myFormat = new SimpleDateFormat("MM/dd/yy");
Date myTest = myFormat.parse(rs.getString("date_mod"))
%>

But the value of: rs.getString("date_mod") is apparently not a valid date
value.

Of course I could manually parse this out based upon patterns, but I would
like to know what I must do to retrieve the dateTime value as a valid date.
Anyone aware of how I might parse and/or convert this one *the right way*?

Thanks.
Neal

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to