How to set time to 24 hour format in Calendar

后端 未结 9 1460
迷失自我
迷失自我 2020-12-25 12:10

I need to set the time on the current date. The time string is always in 24 hour format but the result I get is wrong:

  SimpleDateFormat df = new SimpleDate         


        
9条回答
  •  一个人的身影
    2020-12-25 13:06

    You can set the calendar to use only AM or PM using

    calendar.set(Calendar.AM_PM, int);

    0 = AM

    1 = PM

    Hope this helps

提交回复
热议问题