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

  • Home
  • SEARCH
  • 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 8970565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:44:36+00:00 2026-06-15T17:44:36+00:00

I want to covert from a NSString to NSDate object. My string is :

  • 0

I want to covert from a NSString to NSDate object.
My string is : @"01/01/2013.

Here is the code to convert the string to NSDate:

- (NSDate*) formatDateTimeFromString: (NSString* ) string{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"dd-MM-yyyy"];
    NSDate* date=  [dateFormatter dateFromString:string    ];
    return date;
}

I debug into the function and see that the date object is always nil. Did I have any mistake?

  • 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-15T17:44:37+00:00Added an answer on June 15, 2026 at 5:44 pm

    Your date formatter is wrong (might be hard to see at first)

    Change

    [dateFormatter setDateFormat:@"dd-MM-yyyy"];
    

    to

    [dateFormatter setDateFormat:@"dd/MM/yyyy"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to convert a code from perl to c++, and my problem is
I received DateTime String from Fedex in following format 2012-06-22T21:39:48-05:00 I want to convert
i want to convert flv video(downloaded from you tube) to any other format, i
I want to convert sqlite query to Ormlite query. SELECT * FROM Test where
I'm reading from a binary file and want to convert the bytes to US
We at the company want to convert all the sites we are hosting from
I want to convert : select convert(nvarchar(16), TimeLog, 120) requestTime, count(Request) As noOfQueries from
I have UTF-8 encoded NSData from windows server and I want to convert it
i have output from a server like [alex, \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd] i want to convert it
I'm using opencv2 c++ interface. I want to understand how convert color from Scalar

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.