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

The Archive Base Latest Questions

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

I have this string: 2012-01-12T21:01:00 and this code: NSDateFormatter *df = [[NSDateFormatter alloc] init];

  • 0

I have this string: 2012-01-12T21:01:00 and this code:

    NSDateFormatter *df = [[NSDateFormatter alloc] init];
    [df setDateFormat:@"yyyy-MM-dd hh:mm:ss a"];
    NSDate* arrivalTime=[df dateFromString:field_arrival_time];

But it returns nil. What date format should I use to parse this string?

  • 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-28T03:38:30+00:00Added an answer on May 28, 2026 at 3:38 am

    Your string 2012-01-12T21:01:00 contains the literal T (At least I believe it’s a literal, it doesn’t appear to signify a timezone). You must include this in your date format.

    [df setDateFormat:@"yyyy-MM-dd'T'hh:mm:ss"];
    

    Note the lack of the a in the date format, using it will require your input string to use AM or PM preceded by a white space. For more information on special characters with NSDateFormatter take a look at the Date Formatting Guide paying extra attention to the Fixed Formats.

    Edit: Your input string does not specify a timezone, it will probably be interpreted as UTC and be localized to the timezone of your machine when you output it through NSLog().

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

Sidebar

Related Questions

I have following code: string date = 13.04.2012; string date2 = (DateTime.Parse(date).AddDays(1)).ToString(); This is
I have this string: Fri, 13 Jan 2012 04:26:42 PST I tries to parse
I have a string that contain date: 2012-05-25 and i wan to convert this
I have this as a string 02/06/2012 1:25 PM EST I want to use
I have a date in this string format 02/28/2012 and I want to convert
I have this string in serialize format a:6:{s:5:width;i:452;s:6:height;i:336;s:14:hwstring_small;s:23:height='96' width='128';s:4:file;s:20:2012/01/Picture3_410_1325761656.jpg;s:5:sizes;a:8:{s:9:thumbnail;a:3:{s:4:file;s:35:Picture3_410_1325761656-162x160.jpg;s:5:width;i:162;s:6:height;i:160;}s:6:medium;a:3:{s:4:file;s:35:Picture3_410_1325761656-258x191.jpg;s:5:width;i:258;s:6:height;i:191;}s:8:post-top;a:3:{s:4:file;s:35:Picture3_410_1325761656-110x110.jpg;s:5:width;i:110;s:6:height;i:110;}s:9:post-tiny;a:3:{s:4:file;s:35:Picture3_410_1325761656-108x100.jpg;s:5:width;i:108;s:6:height;i:100;}s:9:post-item;a:3:{s:4:file;s:35:Picture3_410_1325761656-452x327.jpg;s:5:width;i:452;s:6:height;i:327;}s:11:post-review;a:3:{s:4:file;s:35:Picture3_410_1325761656-162x166.jpg;s:5:width;i:162;s:6:height;i:166;}s:9:post-poll;a:3:{s:4:file;s:35:Picture3_410_1325761656-285x237.jpg;s:5:width;i:285;s:6:height;i:237;}s:14:post-top-story;a:3:{s:4:file;s:35:Picture3_410_1325761656-300x130.jpg;s:5:width;i:300;s:6:height;i:130;}}s:10:image_meta;a:10:{s:8:aperture;i:0;s:6:credit;s:0:;s:6:camera;s:0:;s:7:caption;s:0:;s:17:created_timestamp;i:0;s:9:copyright;s:0:;s:12:focal_length;i:0;s:3:iso;i:0;s:13:shutter_speed;i:0;s:5:title;s:0:;}} which is used in wordpress
I have this string 'john smith~123 Street~Apt 4~New York~NY~12345' Using JavaScript, what is the
I have this string in PHP: $string = name=Shake & Bake&difficulty=easy; For which I
I have this string: 123-456-7 I need to get this string: 1234567 How I
I have this string: \Blah \'Blah\' Blah\ . There is another string inside it.

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.