How to set time to 24 hour format in Calendar

后端 未结 9 1426
迷失自我
迷失自我 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 12:42

    Try this :

    SimpleDateFormat df = new SimpleDateFormat("hh:mm");
    

    Or

    SimpleDateFormat df = new SimpleDateFormat("KK:mm");
    

    Reference : SimpleDateFormat

提交回复
热议问题