user3354849
user3354849

Reputation: 11

How to set current month and year (03-2014) as default value in jxdatepicker in java

Am using jxdatepicker in swing to display date. But my requirement is to set current month and year (03-2014) as default. Am able to set default date using below code

   Date date = new Date();
   t_date.setDate(date);

It is giving output as 3/3/14 but i need this as 03-2014

Upvotes: 0

Views: 1590

Answers (1)

tenorsax
tenorsax

Reputation: 21243

You can use setFormats() to replace currently installed formatter. For example:

picker.setFormats(new SimpleDateFormat("MM.yyyy"));

Upvotes: 3

Related Questions