Question

I am trying to display time in this format hh:mm in jsinner control

But I am getting 12 hrs time not 24 hrs

Here is my code

Where am I wrong

Date date = new Date();
SpinnerDateModel sm = new SpinnerDateModel(date, null, null, Calendar.HOUR_OF_DAY);
arr_time.setModel(sm);
JSpinner.DateEditor ar = new JSpinner.DateEditor(arr_time, "hh:mm");
arr_time.setEditor(ar);

Pls guide

Was it helpful?

Solution

Try

JSpinner.DateEditor ar = new JSpinner.DateEditor(arr_time, "HH:mm");

hh indicates 12 hour format. HH indicates 24 hour format

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top