Is there any good and free Date AND Time Picker available for Java Swing?

LazyCoder picture LazyCoder · Mar 17, 2009 · Viewed 63k times · Source

Is there any good and free Date AND Time Picker available for Java Swing?

There are a lot date pickers available but no date AND time picker. This is the closest I came across so far: Looking for a date AND time picker

Anybody?

Answer

Mark picture Mark · Mar 20, 2009

For a time picker you can use a JSpinner and set a JSpinner.DateEditor that only shows the time value.

JSpinner timeSpinner = new JSpinner( new SpinnerDateModel() );
JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "HH:mm:ss");
timeSpinner.setEditor(timeEditor);
timeSpinner.setValue(new Date()); // will only show the current time