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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:09:44+00:00 2026-05-27T23:09:44+00:00

In my app, I get data from Webservices. The data comes in form of

  • 0

In my app, I get data from Webservices. The data comes in form of a XML and I use a parser to parse and get the data I need.

In one of the result, I get the date as 14 DEC 2011. However I would like to display the date as 2011-14-12.

Here is the code I use..

NSDate *endDate = [CommonHelper getDateFromString:[NSString stringWithString:elementValue] :@"dd-MMM-yyyy HH:mm:ss"];

+ (NSDate *) getDateFromString: (NSString *) dateStr: (NSString *) format
{
    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
    [dateFormat setDateFormat:format]; 
    NSDate *newDate = [dateFormat dateFromString:dateStr];
    [dateFormat release];

    return newDate;
}

Would someone be able to help me with how I can do this?

  • 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-27T23:09:44+00:00Added an answer on May 27, 2026 at 11:09 pm

    Use these methods for parsing the date string and formatting the date object as you described:

    + (NSDate *)parseDate:(NSString *)dateString {
        NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
        [dateFormat setDateFormat:@"dd MMM yyyy"]; 
        NSDate *newDate = [dateFormat dateFromString:dateString];
        [dateFormat release];
    
        return newDate;
    }
    
    + (NSString *)formatDate:(NSDate *)date {
        NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
        [dateFormat setDateFormat:@"yyyy-dd-MM"]; 
        NSString *dateString = [dateFormat stringFromDate:date];
        [dateFormat release];
    
        return dateString;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In one of my current applications, I need to get customer data from a
I have an IPhone app that uses webservices to get data from a server.
I have an app that must get data from the Sqlite database in order
Previously i have used restful wcf webservices to get the data from server.But now
I am trying to get data from WebService for my Ipad App. To do
I am working on a C# project where I need to get data from
I am just testing an app to get data off our web server, previously
How can my app get a valid last time connected to domain timestamp from
Trying to get MGTwitterEngine app to build. Getting one pesky error. The following ERROR.
My silverlight app needs to get back to the host from whence it came

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.