I am trying to query a simpledatetime field in my db.
I have a problem with Date type in JSP code. I import
java.sql.* and Date and Time work fine. However when
I try to import java.util.* and
java.text.SimpleDateFormat for formating date, time
and locale, I get error since java.sql.* and
java.util.* both import Date.
I can do something like this for date formating alone
and it works for me with util and SimpleDateFormat:
<%
SimpleDateFormat datef, timef;
Date tim = new Date();
Locale fi = new Locale("fi", "FI");
datef = new SimpleDateFormat("MM-dd-yyyy", fi);
timef = new SimpleDateFormat("HH:mm:ss", fi);
%>
Display formatted date only:<%= datef.format(tim) %>
But here I display query resultset with java.sql.* in
which I can do Date or Time and not both:
<%
if (myResultSet != null) {
while (myResultSet.next()) {
Date x = myResultSet.getDate(n);
...
or
Time x = myResultSet.getTime(n);
...
1.How do I display both time and date?
2.How do I format date?
3.How is date arithmetic done in JSP? on DB side or in
JSP code?
**Note I display as**
<table>
<tr>
<td><%= x %>
</tr>
</table>
__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf! It's FREE.
http://im.yahoo.com/
===========================================================================
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