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 750947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:36:35+00:00 2026-05-14T14:36:35+00:00

I am new to iPhone development. I am parsing a XML URL and display

  • 0

I am new to iPhone development. I am parsing a XML URL and display the title, date and summary in a table view.

I noticed some of the date were very old like “Wed, 31 Dec 1969 19:00:00 -0500”, so I don’t want to display the dates which are 1 year older than the current year. How to do that? I used the sample code from this site for parsing and display the details.

  • 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-14T14:36:35+00:00Added an answer on May 14, 2026 at 2:36 pm

    Dealing with Dates (NSDate Class) is a rather painfull thing to do, and it caused me a lot of trouble and anger.

    basically you have different approaches:

    1.) get components from your date and compare them to your reference dates..
    that could look something like this:

    //given that you have an NSDate object called dateOfSearch

    unsigned int unitFlags = NSDayCalendarUnit|NSYearCalendarUnit;
    NSDateComponents *comp; 
    
    
    NSCalendar *calendar = [NSCalendar currentCalendar];
    
    
    comp = [calendar components:unitFlags fromDate:dateOfSearch];
    NSInteger *year = [comp year];
    

    //year no contains the year that is being contained by the dateOfSearch object.
    //mind you: this is a basic example to show you how to extract the year of an NSDate Object

    2.) use NSDate’s timeReferenceSince1970 or other “equivalents” to do comparison (easier)

    NSDate’s timeReference Methods return the amount of seconds between two referenceDates

    so a good approach would be

    NSDate *today = [[NSDate alloc] init] //today
    NSDate *pastDate = [self getPastDateFromWhereEver];
    NSTimeInterval *difference =  [pastDate timeIntervalSinceDate:today];
    

    if(difference < …..)

    hope that helps

    cheers

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

Sidebar

Related Questions

I am new to iPhone development. I am parsing a URL and displayed its
I'm new to iPhone development. I'm working on a table view (default UITableView subclass)
I am new to iphone development. I have created grouped table and display the
I am new to iPhone/Objective-C development, I am successfully parsing XML with NSXMLParser but
I'm new to iphone development.I have practiced some view based application programs and console
I am new to iphone development.I am parsing an XML page and displaying the
I am quite new to the iphone development, I am using xml parsing to
I am new to iphone development.I am parsing a xml file and displaying the
I am new to iphone development.I am parsing a xml page .The xml page
I am new to iphone development.I am parsing a xml file and displaying the

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.