Win a copy of Learning Java by Building Android Games this week in the Android forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

How to set date in mysql using prepared statement?  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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.

 
Author and ninkuma
Marshal
Posts: 66819
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!