Reputation: 109
I have a jformattedtextfield when i put date in this format "ddMMyyyy". I want when lost focus jformattedtextfield, it becames and shows "dd-mm-yyyy". How i can do this???
Upvotes: 1
Views: 8136
Reputation: 15896
See the below code:
SimpleDateFormat format1 = new SimpleDateFormat("ddMMyyyy");
SimpleDateFormat format2 = new SimpleDateFormat("dd-MM-yy");
Date date = format1.parse("05011999");
System.out.println(format2.format(date));
Upvotes: 2