Parse RSS pubDate to Date object in java

后端 未结 3 686
甜味超标
甜味超标 2020-12-04 19:47

How can I parse a pubDate from a RSS feed to a Date object in java.

The format in the RSS feed: Sat, 24 Apr 2010 14:01:00 GMT

What I have at the moment:

3条回答
  •  甜味超标
    2020-12-04 20:19

    For the lucky one that can use the Java 8 LocalDateTime:

    LocalDateTime localDateTime = LocalDateTime.from(DateTimeFormatter.RFC_1123_DATE_TIME.parse("Sat, 24 Apr 2010 14:01:00 GMT"));
    

提交回复
热议问题