• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to set date in mysql using prepared statement?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When we select the date from the drop down box or writing in text box it needs to store in the date format in mysql database. getting the date input from the user not the current system date or time. please help me out with the code.
I tried the following design page:-

tried with two types of solution one is

and another one was


for both, the result was when I give the input text field 07-06-1988 it is storing the value in database as 0000-00-00 otherwise giving null in the browser. sometimes storing the value as 1970-01-01.
The datatype which I used for date in mysql is data datatype.
I tried even parsing for the string value to convert into date format it didn't worked. Nothing worked out for me.
Please help me out with it... someone please give me the solution for this.

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the JDBC forum as this has nothing to do with JSP.

Your first step, before you do anything else, is to remove this code from the JSP and put it into a Java class. JSPs should have no Java code in them -- and especially no database access code!

You might find this article helpful.
 
Balaji Ragupathy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mr.Bear for your reply and your suggestions. I try to do it.Anyway I might be wrong in the programming but please someone help me out to store date in mysql DATABASE using data type date.
 
reply
    Bookmark Topic Watch Topic
  • New Topic