File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes date inserting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "date inserting" Watch "date inserting" New topic

date inserting

sandeep balyan
Ranch Hand

Joined: Jul 25, 2001
Posts: 134
Hello friends
iam having a problem for date
Iam checking in form for a input if input is Yes than insert date if NO than insert null..I tried lots of things but error is coming Not a date format if I insert null...
can any one tell how is this possible..

Want to do something great will do one day

Joined: Jan 22, 2002
Posts: 5
hi sandeep
u have to format the date
u have to capture the date and format in the required format as desired by thru SIMPLE DATE FORMAT and then store it to database i think the following peice of code will help u
java.util.Date MyDate=new java.util.Date(YourDate);
SimpleDateFormat sdf=new SimpleDateFormat("your desired format like dd/MM/yyyy");
String DateToBeStored=sdf.format(MyDate);

and i think if you do not want the date in a particular format u can directly store the SYSdate without formating but i didnt try that.just try that
I agree. Here's the link:
subject: date inserting
jQuery in Action, 3rd edition