2 Replies - 650 Views - Last Post: 28 July 2009 - 04:31 PM Rate Topic: -----

#1 laksiri_perera  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 26-July 09

Need Java Help

Posted 27 July 2009 - 11:34 PM

Hi

Please give corrections for the following code. I am designing a package for my BIT final year project.

date validation(When text box focus lost)

String testDate = dateTextBox(getText());

SimpleDateFormat sdf = new SimpleDateFormat("yyyymmdd");
try{
testDate = sdf.parse(testDate)
}catch(ParseException e)
JOptionpaneShowMessageDialog(null,"invalid date")

I am trying to get the date from a text box and store in MYSql database in yyyy-mm-dd format but there is something wrong in the code above.

Also need help to generate some reports from mysql(4.1) using Java for the presentation in the viva and project defence.

Please help me.

Is This A Good Question/Topic? 0
  • +

Replies To: Need Java Help

#2 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3536
  • View blog
  • Posts: 16,029
  • Joined: 20-September 08

Re: Need Java Help

Posted 27 July 2009 - 11:53 PM

Quote

SimpleDateFormat sdf = new SimpleDateFormat("yyyymmdd");


would have to be

SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");


although i'm not sure if you want hyphens or not
Was This Post Helpful? 1
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8378
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: Need Java Help

Posted 28 July 2009 - 04:31 PM

Please, in the future, you have already bypassed 2 rules of this forum

Rule #5: Give your topic a descriptive title, NOT "Help" or "Plz Help Me" or "I'm a noob"
"Need Java Help" in a forum dedicated to help people with Java problems is kind of useless
Rule #4: :code:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1