How can I change date from 24-hours format to 12-hours format (am/pm) in android

后端 未结 7 628
Happy的楠姐
Happy的楠姐 2021-01-14 16:56
Calendar ci = Calendar.getInstance();

CiDateTime = \"\" + (ci.get(Calendar.MONTH) + 1) +  
    \"/\" + ci.get(Calendar.DAY_OF_MONTH) + 
    \"/\" + ci.get(Calendar.         


        
7条回答
  •  礼貌的吻别
    2021-01-14 17:19

    Did you try this ?

    SimpleDateFormat dateFromat= new SimpleDateFormat("MM/dd/yyyy  hh:mm  aa");
    Date today = new Date();
    String todayStr = dateFromat.format(today);
    

提交回复
热议问题