String day = request.getParameter("day"); String month = request.getParameter("month"); String year = request.getParameter("xage"); how do I generate the sql date from these three integers int d = Integer.parseInt(day); int m = Integer.parseInt(month); int y = Integer.parseInt(year);
The deprecated Date(y, m, d) constructor sure was a lot easier to use if you don't need i18n (internationalisation). - Peter
I know this post is OLD, but I just needed to say "YOU CAN SAY THAT AGAIN!" I started my JDBC Date Fun trying to use DateFormat, but all of the methods return java.util.Date, not java.sql.Date. To the best of my knowledge (PLEASE correct me if anyone knows better) there is NO way (other than something similar to the above) to simply convert between java.util.Date and java.sql.Date. What a hassle.
hello all, Actually i am using calender class and Timestamp class adn storing the date with time in the sql database , but the thing is while retreiving the date , the second part of the time is not displaying , so can u suggest me how to get the date along wiht time along with seconds . Thanks in advance, bhaskar [This message has been edited by bhaskar nagaraja (edited October 16, 2001).]
Joined: Jun 07, 2000
Don't use the resultset.getDate() method when retrieving value, use resultset.getTimestamp()