GeeCON Prague 2014*
The moose likes JSP and the fly likes Inserting date in database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Inserting date in database" Watch "Inserting date in database" New topic
Author

Inserting date in database

ramkumar chandramohan
Greenhorn

Joined: Nov 19, 2001
Posts: 17
hi,
IN JSP, i have a problem in inserting today's date into a database ,please suggest me .
Thanks
Ramkumar.c
sanagapalli
Greenhorn

Joined: Nov 17, 2001
Posts: 4
Hi,

First of get the current date by using Java.util.Date. After that using JDBC API insert the corresponding values into the database.
Let me know if u have still probelem.
Thanks
Originally posted by ramkumar chandramohan:
hi,
IN JSP, i have a problem in inserting today's date into a database ,please suggest me .
Thanks
Ramkumar.c


Srinivasa Rao S
ramkumar chandramohan
Greenhorn

Joined: Nov 19, 2001
Posts: 17
hi,
ya first using the calendar class i got the today's date ,when i trying to insert into the database i am geting a problem.Then by using util.Date i tried still i am getting a problem ,so please help me out with more details.
Thanks
Ramkumar.c
dagmar timler
Greenhorn

Joined: Nov 16, 2001
Posts: 11
what exactly is your problem?
- the date not being inserted correctly?
- the date being inserted as a different date?
- the date not being inserted at all?
- an exception being thrown?
ramkumar chandramohan
Greenhorn

Joined: Nov 19, 2001
Posts: 17
hi ,
Ya,date not being inserted at all and the exception being thrown

Originally posted by dagmar timler:
what exactly is your problem?
- the date not being inserted correctly?
- the date being inserted as a different date?
- the date not being inserted at all?
- an exception being thrown?

dagmar timler
Greenhorn

Joined: Nov 16, 2001
Posts: 11
okay. what is the exception?
Dharmesh Chheda
Ranch Hand

Joined: May 08, 2001
Posts: 204

you need to get your date string in the proper format meaning get it in the format
"01-12-1999 12:00:00" and insert into the database field which is of DATE type


regards,<br />Dharmesh Chheda
ramkumar chandramohan
Greenhorn

Joined: Nov 19, 2001
Posts: 17
hi dharmesh,
Thanks for ur timely help.
bye
C.Ramkumar
Originally posted by Dharmesh Chheda:
[B]
you need to get your date string in the proper format meaning get it in the format
"01-12-1999 12:00:00" and insert into the database field which is of DATE type
[/B]

 
GeeCON Prague 2014
 
subject: Inserting date in database