Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 591703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:39:44+00:00 2026-05-13T15:39:44+00:00

I iterate a RSS feed like so where _file is the feed d =

  • 0

I iterate a RSS feed like so where _file is the feed

d = feedparser.parse(_file)
for element in d.entries: 
    print repr(element.date)

The date output comes out like so

u'Thu, 16 Jul 2009 15:18:22 EDT'

I cant seem to understand how to actually quantify the above date output so I can use it to limit feed elements. I So what I am asking is how can I get a actual time out of this, so I can say if greater then 7 days old, skip this element.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:39:44+00:00Added an answer on May 13, 2026 at 3:39 pm

    feedparser is supposed to give you a struct_time object from Python’s time module. I’m guessing it doesn’t recognize that date format and so is giving you the raw string.

    See here on how to add support for parsing malformed timestamps:

    http://pythonhosted.org/feedparser/date-parsing.html

    If you manage to get it to give you the struct_time, you can read more about that here:

    http://docs.python.org/library/time.html#time.struct_time

    struct_time objects have everything you need. They have these members:

    time.struct_time(tm_year=2010, tm_mon=2, tm_mday=4, tm_hour=23, tm_min=44, tm_sec=19, tm_wday=3, tm_yday=35, tm_isdst=0)

    I generally convert the structs to seconds, like this:

    import time
    import calendar
    
    struct = time.localtime()
    seconds = calendar.timegm(struct)
    

    Then you can just do regular math to see how many seconds have elapsed, or use the datetime module to do timedeltas.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My iPad app features a UITableView populated from a feed. Like most RSS readers,
I would like to iterate over the below and output a string that combines
I need to iterate over a list (or whatever enumeration), but I'd like to
I need to iterate over all request header objects and print it in App
I am trying to iterate through a directory and output if the current item
Normally when you iterate through a mysql result you do something like this: while
I have built an RSS Feed widget but my problem is how do I
I'm trying to print all the <title> and <description> elements of an RSS 2.0
I would like to iterate through all elements in an std::list in parallel fashion
Possible Duplicate: How to iterate through an array starting from the last element? (Ruby)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.