Change date string format in android

后端 未结 6 749
忘了有多久
忘了有多久 2020-12-01 04:14

I am getting date string from SAX parsing like this: Wed, 18 Apr 2012 07:55:29 +0000

Now, I want this string as : Apr 18, 2012 01:25 PM

6条回答
  •  旧时难觅i
    2020-12-01 05:03

    From oficial documentation, in the new API (18+) you should be implement this:

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.US);
    String time=sdf.format(new Date());
    

    Documentation: http://developer.android.com/reference/java/text/SimpleDateFormat.html

提交回复
热议问题