Android SimpleDateFormat format issue

前端 未结 1 1830
心在旅途
心在旅途 2021-01-27 15:14

I am trying to format a date into required format. but i receive wrong date out put. here is what i am doing.

I receive the dates as following:

3/24/2012         


        
1条回答
  •  北荒
    北荒 (楼主)
    2021-01-27 15:39

    SimpleDateFormat("mm/dd/yyyy hh:mm:ss a");
    

    mm means minute in the hour. you should use MM

    try with

    SimpleDateFormat("MM/dd/yyyy hh:mm:ss a");
    

    0 讨论(0)
提交回复
热议问题