|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
my application is a web based library system and using java/jasp with tomcat and mysql. i want to know how to get date when adding a book loan to borrower and calculate return date. and i need the java /sql time convertion .
thanks in advance. |
|
#2
|
||||
|
||||
|
If you're talking about converting the java date into a format that can be put in a database, this might be your solution.
> > Any solution? How can I insert a java.util.date obtained from a calendar > object in a Oracle DB (java.sql.Date)? > Calendar stCal = Calendar.getInstance(); java.util.Date utlDate = stCal.getTime(); java.sql.Date sqlDate = new java.sql.Date(utlDate.getTime()); stmt.setDate(COLUMN_DATA, sqlDate); I'll be honest : this solution isn't mine but it's written by Thomas Kellerer. I found it at http://www.dbforums.com/archive/index.php/t-1100948.html. |
|
#3
|
|||
|
|||
|
date and time ..java/ mysql / jsp
hi ,
what i did is wrote in top of jsp of addLend.jsp <%@page import="java.util.*" %> java.util.Date lenDate = new java.util.Date(); and wrote in bean class private Date lendDate; private Date returnDate; and i need to define the returnDate as 4 days plus the lendDate. i dont know how to do it. later i have to convert java.util.Date in to mysql date type. it's ok with me. i'll try the method you mentioned |
|
#4
|
||||
|
||||
|
I'm afraid I can't give you any code I've written as example. And you will have to learn about the class Calendar as well. It's true that Java does not have an easy way to manipulate dates. Some of the methods of the class java.util.Date are deprecated and it is strongly recommended you should use the methods of Calendar instead. Which means you will have to work with this class.
I suggest you read the following article : http://www.onjava.com/pub/a/onjava/2003/06/05/java_calendar.html |
|
#5
|
|||
|
|||
|
thanks a lot.
it's a good tutorial . |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > help please |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|