How to parse pubDate from rss in flutter?

336 views Asked by At

I am trying to parse pubDate from rss into DateTime object.

String parseFormat = "ddd, dd MMM yyyy HH:mm:ss zzz";
this.pubDate = new DateFormat(parseFormat).parse(json['pubDate']);

This throws error

Trying to read ddd from Thu, 14 May 2020 09:40:15 EST at position 0

1

There are 1 answers

0
Kshitij Dhakal On BEST ANSWER

Changed to

String parseFormat = "E, dd MMM yyyy HH:mm:ss zzz";
this.pubDate = new DateFormat(parseFormat).parse(json['pubDate']);

from the documentation.