Wednesday 15 February 2012

android - Parse SimpleDateFormat of RSS -


I have an app that reads an RSS from the website (Tuesday, 17 March 2015 12:41:41 + 0000) . I get this format date (Tuesday, March 17, 12:41:41 GMT 2015) and I want to receive it: Tuesday 17th March Spanish Martes, 17 Marzo .

I am trying different forms, but I can not parse the date.

This is my code:

  date format format = new simpledataformat ("EEEE, DD MMMM YKKKK: mm: SSZ", locale.ENGLIISH);  

The Porcian code where I get the data of XML parse:

  else if (name.equalsIgnoreCase ("pubDate")) {noticia.setFecha (formatter .parse ("+ + property.getFirstChild () getNodeValue ()).);    

The following code snippets parse the date of the English Tuesday, March 17, 2015 12: 41: 41 +0000 and try it martes, 17 Marcho

  in Spanish representation (simple data format SDF = new simpledate format ("EEE, DD MMMM yyyy kk: mm: ss ", locale. NGLIISH); Date date = sdf.parse ("Mars, 17 March 2015 12:41:41 +0000"); SimpleDetformFormat SDF2 = New SimpleDormat ("EEEE, DD MMMM", New Locale ("SE", "ESE")); System.out.println ("Date:" + sdf2.format (date)); } Hold (ParseException e) {e.printStackTrace (); }  

No comments:

Post a Comment