Convert 24 Hour Time in to 12 Hour Time in Java

后端 未结 2 891
心在旅途
心在旅途 2021-01-22 13:30

I want to convert 24 Hour time into 12 Hour AM/PM time. e.g:- How to convert date 2012-03-20T22:30:00.000+05:30 to to 2012-03-20 10:30 PM??

I have extratced the date but

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-22 14:06

    Try this:

    String dateStr = new SimpleDateFormat("yyyy-MM-dd hh:mm a").format(new Date());
    

提交回复
热议问题