How to set time to 24 hour format in Calendar

后端 未结 9 1423
迷失自我
迷失自我 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

    if you replace in the function SimpleDateFormat("hh") with ("HH") will format the hour in 24 hours instead of 12.

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

提交回复
热议问题