Check out java.text.SimpleDateFormat  It is one of my BEST FRIENDS!

Used something like this:

    static SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
    ...
    Date myDate = new Date();
    ...
    out.println(sdf.format(myDate));



-----Original Message-----
From: Rice, David [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 16, 2001 3:34 PM
To: [EMAIL PROTECTED]
Subject: Re: Using DATE and CALENDAR objects...


Chris,

Unfortunately, I do have to parse dates to extract needed information. The
app I'm building is a log analysis tool that expects not only the complete
timestamp, but also needs the day_of_week, day_of_month, et cetera, broken
out. We take that information, along with other environment variables to
compile access/usage reports for the higher ups. And I have to use
PreparedStatements due to the fact that I'm doing joined-table inserts. I
just haven't figured out how to incorporate the DATE/CALENDAR stuff into
them yet... ;)

I've been through the docs at:
http://java.sun.com/products/jdk/1.2/docs/api/ but they're more confusing
than anything and provide no examples that I can decipher at this point. I
also went to the tutorial suggested by Geert as well but that is much more
convoluted than what I'll need, I'm thinking.

Nonetheless, I appreciate all the feedback and help!

David
--------------------------

-----Original Message-----
From: Chris Pratt [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 16, 2001 5:16 PM
To: [EMAIL PROTECTED]
Subject: Re: Using DATE and CALENDAR objects...


The best way is to use PreparedStatement's and the
setDate/setTime/setTimestamp methods.  Then you don't have to parse the
dates at all.
    (*Chris*)

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
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".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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