0

I am using JDateChooser from jcalendar-1.2.2 jar. I have set dateformatString as "yyyyMMdd".By default it is showing today's date September 1, 2010. whenever I try to change the date it is displayed correctly in yyyyMMdd format. How to set default format for default date (todate).

mKorbel
  • 109,525
  • 20
  • 134
  • 319
MRavindran
  • 447
  • 2
  • 10
  • 24
  • 1
    It would really, really help if you could provide a short but complete program demonstrating the problem. Just the most basic UI that shows the issue. – Jon Skeet Sep 01 '15 at 12:04
  • 1
    JCalendar.setDateFormat(new SimpleDateFormat("Xx.Xx.Xxxx")); or to setLocale(new Locale("Xxxxxxx")), Im sure that here is manz posts about, note all docs, demos, resources about JCalendar aren't accesible, url server is down – mKorbel Sep 01 '15 at 12:18

1 Answers1

2

Is this what you are trying to get ?

    public class TestJFrame extends JFrame {

        /**
         *
         */
        public TestJFrame() {

        //set test frame 
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            setPreferredSize(new Dimension(100,100));

             //make a date chooser 
            JDateChooser dateChooser = new JDateChooser();
            //set date format 
            dateChooser.setDateFormatString("yyyyMMdd");
            //set date 
            dateChooser.setDate(new Date());

            //add to test frame 
            getContentPane().add(dateChooser);
            pack();
            setVisible(true);

        }

        /**
         * @param args
         */
        public static void main(String[] args) {

            new TestJFrame();

        }
    }

It may help you find what's wrong.

c0der
  • 18,467
  • 6
  • 33
  • 65