how to convert date format in android

后端 未结 6 608
梦谈多话
梦谈多话 2020-11-30 08:58

I am getting date into string in YYYY/MM/DD HH:MM:SS format.I want to change it into the mm/dd/yyyy HH:mm:ss and also it will show AM and PM how ca

6条回答
  •  臣服心动
    2020-11-30 09:33

    just use the Time class. Try something similar to this.

    Time time = new Time();
    time.set(Long.valueOf(yourTimeString));
    

    If you really need a Date object just try this.

    Date date = new Date(Long.parse(yourTimeString));
    

提交回复
热议问题