Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to retrieve timestamp in my servlet

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I'm using mysql as my backend. and when i say rs.getString("create_date"); in my sql its giving error.

the create_date field is of data type TIME STAMP which has the format
0000-00-00 00:00:00

is there anyway out i can get the date in the format 0000-00-00 or i can store the while timestamp value in the format 0000-00-00 00:00:00
 
Jan Cumps
Bartender
Posts: 2599
12
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jigar Naik:
Hi

I'm using mysql as my backend. and when i say rs.getString("create_date"); in my sql its giving error.

the create_date field is of data type TIME STAMP which has the format
0000-00-00 00:00:00

is there anyway out i can get the date in the format 0000-00-00 or i can store the while timestamp value in the format 0000-00-00 00:00:00

It would be usefull to tell us exactly what error you get.

Timestamps can be retrieved by using (pseudocode):


You can format this Date as you please, using the SimpleDateFormat.

Regards, Jan
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya i tried that one but still getting error...

ERROR :
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok problem solved. actually there was a blank tuple in my table. thats why it was giving error.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic