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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:58:39+00:00 2026-06-01T17:58:39+00:00

I am getting date in string formate ad 2012-04-11T07:51:10+0000 & I want to convert

  • 0

I am getting date in string formate ad “2012-04-11T07:51:10+0000” & I want to convert it to NSDate as “11-04-2012”. I dont understand how to use “setDateFormat” for this.

This is what I am doing–
[dateFormatter setDateFormat:@”yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss’+’zzzz”];

Please help.

And whatever NSDate I will get I again want to convert to string ie. only 11-04-2012.
I have searched on ggl. But no satisfactory result 🙁

please help.

  • 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-01T17:58:40+00:00Added an answer on June 1, 2026 at 5:58 pm

    Here is how to parse the string to generate a date:

    NSString *dateString = @"2012-04-11T07:51:10+0000";
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateFormat = @"yyy-MM-dd'T'HH:mm:ssZ";
    NSDate *date = [formatter dateFromString:dateString];
    NSLog(@"Date: %@", date);
    

    Now you can generate a new string representation of the date as follows:

    formatter.dateFormat = @"dd-MM-yyyy";
    NSString *newDateString = [formatter stringFromDate:date];
    NSLog(@"New string: %@", newDateString);
    // 11-04-2012
    

    The problem with the dateFormat you were using is that you don’t have to escape all the symbols such as 'MM' and that zzzz is not the correct symbol to parse the timezone of type +0000.

    Have a look at this documentation for more information.

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

Sidebar

Related Questions

I am getting the date string from the server as 2012-06-21 18:13:33 -04:00 What
I am getting date into string in YYYY/MM/DD HH:MM:SS format.I want to change it
Basically, I'm getting a date time string from an API, and I want to
Im trying to parse a String thats a date 2012-07-15T20:55:33+00:00, however I keep getting
I am getting an error in converting string to date in C#. The error
For PDT, I would want -0700. I'm getting a date in the past to
I'm getting from my webapp date and time in format: 2012-02-23T23:25:22Z I tried with
I am getting a Date format in String as Output like this. Fri May
I have Date in this format (2012-11-17T00:00:00.000-05:00). I need to convert the date into
indexNumber.row is a date like 2012-03-09 23:00:00 +0000 . I've tried a handful of

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.