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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:07:46+00:00 2026-06-11T09:07:46+00:00

I trying to convert a NSString that looks like this: @00:00 15 September 2012

  • 0

I trying to convert a NSString that looks like this:

@"00:00 15 September 2012"

to a NSDate.

I can’t figure out what the unicode format needs to be. I am trying this:

@"HH:mm dd MMMM YYYY"
@"HH:mmddMMMMYYYY"

I’ve been trying to follow the rules here but to no avail.


EDIT:

Paul’s answer does work (except for military time problem). I was trying to use Apple’s example of how to create a format template like so:

NSString *formatString = [NSDateFormatter dateFormatFromTemplate:@"hh:mm dd MMM yyyy" options:0
                                                              locale:[NSLocale currentLocale]];

NSDateFormatter* fmt = [NSDateFormatter new];
[fmt setDateFormat:formatString];

This causes everything to spit out null.

However, if I do this:

NSDateFormatter* fmt = [NSDateFormatter new];
[fmt setDateFormat:@"hh:mm dd MMM yyyy"];

All is well in the world. My only guess is that NSLocale doesn’t work in simulator?

  • 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-11T09:07:47+00:00Added an answer on June 11, 2026 at 9:07 am

    You wasn’t far off, you need something like:

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    dateFormatter.dateFormat = @"HH:mm dd MMM yyyy";
    dateFormatter.timeZone = [[NSTimeZone alloc] initWithName:@"GMT"];
    
    NSLog(@"%@", [dateFormatter dateFromString:@"00:00 15 September 2012"]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple case of trying to prove I can convert NSString to NSDate . Create
I am trying to figure out how to take a given NSString and convert
I have a String which looks like this NSString *string = @2012-04-30T23:59:00+10:00; Right now,
I am trying to convert nsstring to nsdate and then to the systemtimezone. Is
I'm trying to convert a NSString to an NSDate. If the iPhone region is
I'm trying to convert this string 2011-11-23T17:59:00Z to an NSDate. I've seen many people
Trying to convert strings that contain an escaped unicode (ex: \u3400) in the range
I am trying to convert an NSString to an NSDate with time. Here's what
I'm trying to convert a NSString (a path to a file in the documents
I am trying to convert a NSString into a double using the following: double

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.