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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:33:29+00:00 2026-06-05T07:33:29+00:00

I am trying this since last two hours and finaly left it out for

  • 0

I am trying this since last two hours and finaly left it out for you guys 😛

I need to convert this String Mon, 14 May 2012, 12:00:55 +0200
into Date dd/mm/yyyy hh:ss format..

Any kind of help towards the goal will be really appreciated.

What I have tried

I have tried using NSDateFormatter but I am unable to figure out the exact format of the above date.
This [dateFormatter setDateFormat:@"EEEddMM,yyyy HH:mm:ss"]; is how I have tried and many other formats too

Eg:

 NSString *finalDate = @"Tue, 29 May 2012, 14:24:56 +0200";
 NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
 [dateFormatter setDateFormat:@"EEEddMM,yyyy HH:mm:ss"];
  NSDate *date = [dateFormatter dateFromString:finalDate];

Here the date alwasys comes as nil

  • 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-05T07:33:30+00:00Added an answer on June 5, 2026 at 7:33 am

    The most important part of date formatting is often forgotten, tell the NSDateFormatter the input language:

    NSDateFormatter *dateFormatter = [NSDateFormatter new];
    [dateFormatter  setDateFormat:@"EEE, dd MMMM yyyy, HH:mm:ss Z"];
    dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"EN"];
    NSDate *date = [dateFormatter dateFromString:@"Mon, 14 May 2012, 12:00:55 +0200"];
    NSLog(@"date: %@", date);
    

    I’ve checked the output: date: 2012-05-14 10:00:55 +0000

    Be aware that the HH in the date formatter is for 24hr.

    Now I would suggest not to use a fixed output scheme, but use one of the NSDateFormatterStyle:

    [dateFormatter setDateStyle:NSDateFormatterShortStyle];
    [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
    
    NSString *dateString = [dateFormatter stringFromDate:date];
    
    NSLog(@"date: %@", dateString);
    

    Which in american english will output: 5/14/12 12:00 PM


    This code is valid for ARC if you are not using ARC add autorelease to the NSLocale and release the NSDateFormatter after you are done with it.

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

Sidebar

Related Questions

I'm trying this for almost two hours now, without any luck. I have a
I have been trying to validate my web page for the last two hours,
I was trying to build Boost C++ Libraries for last two hours and stopped
I'm trying this in two application; a console application and a web application. In
I've been trying this for hours, so maybe a fresh set of eyes will
It's been two years since I last coded something in Java so my coding
I am trying to learn Asp.net Mvc so I am trying out this Tutorial.
I've been looking at this for the last few hours, and can't really achieve
Im trying this, but when i press it it dont changes, it only displays
I'm trying this pattern: (r'^jobs/(?P<job_id>\d+)/$', job_handler) To work with jobs/ and jobs/{job_id}, but 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.