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

Inserting Date value by using JSP......Please help

 
Vasanth Padmanaban
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I don't know how to insert date value into Database. Shall i use the following code:
date ToDate =ToMon+"/" + ToDay +"/"+ ToYear;
 
Val Pecaoco
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vasanth,
Try using date format classes on your date object to convert it into a date/time string. I normally use the DateFormat class from the java.text package, e.g.,

You can then insert formattedDate in a date/time table column.
Hope that helps.
Ex Animo Java!
-- Val
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic