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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:17:57+00:00 2026-06-12T13:17:57+00:00

Has anyone noticed that iOS6 NSDateFormatter defaults to year 2000 when no year is

  • 0

Has anyone noticed that iOS6 NSDateFormatter defaults to year 2000 when no year is given while in

iOS6:

[[NSDateFormatter alloc] init] dateFromString: @”7:30am”]

=> 2000 Jan 1st, 7:30am

iOS5:

=> 1970 Jan 1st, 7:30am

Question:
1. Is there a better way to compare two different times? I have this subway app PATH Schedule/Map. The subway times are hardcoded in the database as numSecondsSince1970. I give people the next train arriving by comparing departure times with the current numSecondsSince1970.
Right now I am just appending the year 1970 to the time string “2:30am” => “1970 2:30am” but it seems like there is a better way

Thanks!

  • 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-06-12T13:17:58+00:00Added an answer on June 12, 2026 at 1:17 pm

    Yes I just noticed this issue. Apparently this bug is reported at Apple, see http://openradar.appspot.com/12358210


    Edit: this is how I dealt with this issue in a project I’m working on…

    // I use the following code in a category to parsing date strings
    
    - (NSDate *)dateWithPath:(NSString *)path format:(NSString *)format
    {
        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        formatter.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];
        formatter.dateFormat = format;
    
        NSString *string = [self valueWithPath:path];
        return [formatter dateFromString:string];
    }
    

    // old parsing code that worked fine in iOS 5, but has issues in iOS 6
    
    NSDate *date            = [element dateWithPath:@"datum_US" format:@"yyyy-MM-dd"];
    NSDate *timeStart       = [element dateWithPath:@"aanvang" format:@"HH:mm:ss"];
    NSTimeInterval interval = [timeStart timeIntervalSince1970];
    match.timeStart         = [date dateByAddingTimeInterval:interval];
    

    and the fix …

    // the following code works fine in both iOS 5 and iOS 6
    
    NSDate *date                = [element dateWithPath:@"datum_US" format:@"yyyy-MM-dd"];
    NSDate *timeStart           = [element dateWithPath:@"aanvang" format:@"HH:mm:ss"];
    NSCalendar *calendar        = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
    calendar.timeZone           = [NSTimeZone timeZoneForSecondsFromGMT:0];
    NSUInteger units            = NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
    NSDateComponents *timeComps = [calendar components:units fromDate:timeStart];
    match.timeStart             = [calendar dateByAddingComponents:timeComps toDate:date options:0];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want to see if anyone else has noticed that when loading images
Has anyone noticed that intellij 9 broke the auto scroll to source feature? it
Has anyone else noticed that IE9's standard implementation of CSS box-shadow differs from other
Has anyone noticed this behavior? I'm trying to write a script that will trigger
Has anyone else noticed that their command line java applications in OSX create GUI
I don't know if anyone has noticed that Eclipse has this annoying feature where
Has anyone used SIFR or Facelift (FLIR) with ASP.net? I noticed that all the
I noticed that this was asked in the following post . Has anyone used
Has anyone noticed that if you import an exe as resource it gets rebased
Has anyone else noticed that when you have the CSS:hover effect applied to an

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.