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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:06:16+00:00 2026-06-06T21:06:16+00:00

I have issues with date parsing. It works on my devices and simulator, but

  • 0

I have issues with date parsing. It works on my devices and simulator, but not on client device (which is also iPhone iOS 5.1.1, but maybe a different configuration)

    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    NSDate          *date = nil;
    NSError         *error = nil; 

    [formatter setDateFormat:@"EEE, dd MMM y HH:mm:ss zzz"];
    if (![formatter getObjectValue:&date forString:@"Mon, 21 Jun 2012 21:21:21 GMT" range:nil error:&error])
    {
        NSLog(@"%@", error);
    }

which outputs

Error Domain=NSCocoaErrorDomain Code=2048 "The operation couldn’t be completed. (Cocoa error 2048.)" UserInfo=0x446f10 {NSInvalidValue=Mon, 21 Jun 2012 21:21:21 GMT}
  • 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-06T21:06:17+00:00Added an answer on June 6, 2026 at 9:06 pm

    You need to set the locale on the date formatter to en_US_POSIX.

    formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following ajax call which works perfectly in Firefox and Chrome but
I have an issue with parsing a date during a unit test run, but
I have a JSON response which contains a timestamp, but I'm having some issues
I have issues with Firefox and keydown function. It will not trigger the function
I have some issues in setting the classpath for the a project for which
I have a strange problem when parsing a ISO8601 date and time with SimpleDateFormat.
I have this problem with Safari not recognizing the date format 2012-01-03 (being 2012
I have issues with .NET CF 3.5 application on Windows Mobile 6.5 on Motorola
I have issues with NSUserDefaults and I don't quite understand what is going on.
We have issues within an application using a state machine. The application is implemented

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.