Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inserting date in database

 
ramkumar chandramohan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
IN JSP, i have a problem in inserting today's date into a database ,please suggest me .
Thanks
Ramkumar.c
 
sanagapalli
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
ramkumar chandramohan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay. what is the exception?
 
Dharmesh Chheda
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

 
ramkumar chandramohan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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]

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic