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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:29:44+00:00 2026-05-28T08:29:44+00:00

I have the following NSString : NSString * dateString = @2012-01-24T14:59:01Z; I want to

  • 0

I have the following NSString:

NSString * dateString = @"2012-01-24T14:59:01Z";

I want to create an NSDate from that string. I looked up the NSDate Class Reference and thought of using dateWithNaturalLanguageString::

Creates and returns an NSDate object set to the date and time
specified by a given string.

+ (id)dateWithNaturalLanguageString:(NSString *)string

Parameters
string
A string that contains a colloquial specification of a date,
such as “last Tuesday at dinner,” “3pm December 31, 2001,” “12/31/01,”
or “31/12/01.”
Return Value
A new NSDate object set to the current
date and time specified by string.

However, when I’m trying to use it like this:

NSDate * date = [NSDate dateWithNaturalLanguageString:dateString];

I’m getting the following error:

No known class method for selector ‘dateWithNaturalLanguageString:’

  • 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-28T08:29:45+00:00Added an answer on May 28, 2026 at 8:29 am

    Found exactly what I was looking for here. It’s an RFC 3339 date-time.

    - (NSString *)userVisibleDateTimeStringForRFC3339DateTimeString:(NSString *)rfc3339DateTimeString
        // Returns a user-visible date time string that corresponds to the
        // specified RFC 3339 date time string. Note that this does not handle
        // all possible RFC 3339 date time strings, just one of the most common
        // styles.
    {
        NSString *          userVisibleDateTimeString;
        NSDateFormatter *   rfc3339DateFormatter;
        NSLocale *          enUSPOSIXLocale;
        NSDate *            date;
        NSDateFormatter *   userVisibleDateFormatter;
    
        userVisibleDateTimeString = nil;
    
        // Convert the RFC 3339 date time string to an NSDate.
    
        rfc3339DateFormatter = [[[NSDateFormatter alloc] init] autorelease];
    
        enUSPOSIXLocale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease];
    
        [rfc3339DateFormatter setLocale:enUSPOSIXLocale];
        [rfc3339DateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"];
        [rfc3339DateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
    
        date = [rfc3339DateFormatter dateFromString:rfc3339DateTimeString];
        if (date != nil) {
    
            // Convert the NSDate to a user-visible date string.
    
            userVisibleDateFormatter = [[[NSDateFormatter alloc] init] autorelease];
            assert(userVisibleDateFormatter != nil);
    
            [userVisibleDateFormatter setDateStyle:NSDateFormatterShortStyle];
            [userVisibleDateFormatter setTimeStyle:NSDateFormatterShortStyle];
    
            userVisibleDateTimeString = [userVisibleDateFormatter stringFromDate:date];
        }
        return userVisibleDateTimeString;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following simple class: @interface Article: NSObject { NSString *title; } @property (copy,
I want to convert the following NSString to a NSDate : @2013-04-01T22:00:00Z I am
I have following array and search string. NSArray *values =[NSArray arrayWithObjects:@abc,@xyz,@cba,@yzx,nil]; NSString *search =
Given an object foo of class Foo, I want to do the following: NSString
I have the following example class: Test.h: @interface Test : UIButton { NSString *value;
I have the following string: NSString *dateStr = @2010-01-15; which I'm trying to convert
I have the following function: - (NSString *)urlEncodedValue { NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(
I have the following code: .h NSString *mainString; .m case 0: case 1: case
I have the following code to open google maps: NSString *urlString = [NSString stringWithFormat:@http://maps.google.com/maps?q=%@,
I have the following view controller in my UIPopover: @protocol StorePopoverDelegate - (void)storeSelected:(NSString *)store;

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.