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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:51:39+00:00 2026-05-28T02:51:39+00:00

I am doing an application where I am using the following link http://iosdevelopertips.com/cocoa/date-formatters-examples-take-3.html to

  • 0

I am doing an application where I am using the following link http://iosdevelopertips.com/cocoa/date-formatters-examples-take-3.html to convert the date from string.

I am using below code to same by following above tutorial link. when I NSlog PresentDateTime it gives 20120111 13:03:49.263+05:30.

so I am taking this format and want to convert into the format of “EEEE MMMM d, YYYY h:mm a, zzz“.

To do so when I assign the same to the variable

NSString *today = presentDateTime;

when I NSLog Datestring I am getting result NULL can I know where I am going wrong? please help me to solve this issue by suggesting what changes to be done

//code

 -(NSString *)DateFormat:(NSString *) presentDateTime

{


presentDateTime = [presentDateTime stringByReplacingOccurrencesOfString:@"T" withString:@" "];
presentDateTime = [presentDateTime stringByReplacingOccurrencesOfString:@" +" withString:@"+"];
presentDateTime = [presentDateTime stringByReplacingOccurrencesOfString:@"-" withString:@""];
NSLog(@"Present date::::%@",presentDateTime);

  NSString *today = presentDateTime;
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyyMMdd HH:mm:ss:SSSZZZ"];
NSDate *date = [dateFormat dateFromString:today];

[dateFormat setDateFormat:@"EEEE MMMM d, YYYY h:mm a, zzz"];
NSString *dateString = [dateFormat stringFromDate:date];
[dateFormat release];
NSLog(@"dateString:::Date>>>>:%@::::\n%@",dateString, presentDateTime);
return dateString;
  • 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-28T02:51:40+00:00Added an answer on May 28, 2026 at 2:51 am

    Your date format pattern for parsing the date is wrong/incomplete. For the string 20120111 13:03:49.263+05:30 the format would be YYYYMMdd HH:mm:ss.SSSZZZ. See this table for the format string patterns.

    Edit: After playing around with the code, it turns out that the NSDateParser chokes on the timezone +05:30. It expects +0530, without the colon. Here’s how to remove it:

        NSString *today = @"20120111 13:03:49.263+05:30";
        NSRange colon = [today rangeOfString:@":" options:NSBackwardsSearch];
        if (colon.location != NSNotFound) {
            today = [today stringByReplacingCharactersInRange:colon withString:@""];
        }
        NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
        [dateFormat setDateFormat:@"YYYYMMdd HH:mm:ss.SSSZZZ"];
        NSDate *date = [dateFormat dateFromString:today];
        NSLog(@"%@", date);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've set up application.html.erb to link to a stylesheet using the following code <%=
I am doing mail parsing application which required to convert the HTML file to
Using following method to create Shopping Cart Session http://net.tutsplus.com/tutorials/other/build-a-shopping-cart-in-aspnet/ Now running locally on my
I am using jaxb for my application configurations I feel like I am doing
I'm using rails, but doing all my Javascript unobtrusively using jQuery in application.js .
We need to represent huge numbers in our application. We're doing this using integer
I'm writing a WPF application using the MVVM pattern, based on the following article:
Given a web application built using Jboss seam with following details: dynamic web module:
I'm using the following code as a link to delete a todo in a
Using following console application i am converting each string to uppercase letters. But string

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.