• Post Reply Bookmark Topic Watch Topic
  • New Topic

Date Format??

 
Mona lisa
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!!
when i save a date 22-Feb-2002(dd-mm-yyyy)
from text field into database,it save. but in case of Finding then the format change into
2002-22-2.plz help me to solve this promlem.
 
Jack Nicholson
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
After getting the date from database, do operations on the date data. Like given below-->

String dt=rs.getDate("Fieldname").toString();
//System.out.println("Date "+dt);
SimpleDateFormat sdf = new SimpleDateFormat( "MM/dd/yyyy" );
//here date format should be converted to your required format.
sdt = sdf.format(dt);
//System.out.println("Formatted Date "+sdt);

& then take the String for display purpose.
Hope this helps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!