Reputation: 11
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
Reputation: 21243
You can use setFormats()
to replace currently installed formatter. For example:
picker.setFormats(new SimpleDateFormat("MM.yyyy"));
Upvotes: 3