0

I have an Android app that parses a RSS feed. The "date" item returns the date in this format: "Mon, 16 Jun 2014 14:31:00 +0000". How can I convert this to the default device format?

Guillermo Barreiro
  • 1,365
  • 1
  • 11
  • 13

2 Answers2

1

Use simpleDateFormat

Something like:

SimpleDateFormat sdf = new SimpleDateFormat("E, dd MMM yyyy hh:mm:ss Z")
ControlAltDel
  • 33,923
  • 10
  • 53
  • 80
  • 1
    This, and to get the user's preferred date format, see [this answer](http://stackoverflow.com/a/6982154/1079597). – cjm Aug 28 '14 at 20:40
0

First parse this to a Date object

String str = "Mon, 16 Jun 2014 14:31:00 +0000";
Date date = new SimpleDateFormat("E, d, M yyyy H:m:s Z", Locale.ENGLISH).parse(str);
Simas
  • 43,548
  • 10
  • 88
  • 116