0

how to change month format in jDateChooser ? this is my code :

    private DateFormat df = DateFormat.getDateInstance();

    private void jButtonInsertActionPerformed(java.awt.event.ActionEvent evt) { 
            String x = df.format(jDateChooser.getDate());
            showtable(x); // this method for showing Date to jTable 
    }

example output : 04 Mar 15, and I want to change Month name "Mar" to "03", but don't know how to change it. Please help

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Okem
  • 395
  • 1
  • 4
  • 12

1 Answers1

1

Use the SimpleDataFormat class instead

http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

Replace this

private DateFormat df = DateFormat.getDateInstance();

with this

private SimpleDateFormat df = SimpleDateFormat("dd MM yy");

You can customise any format you want here

abcdef
  • 441
  • 3
  • 13