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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:26:19+00:00 2026-05-24T14:26:19+00:00

I ask a database for the date of an object. I get back a

  • 0

I ask a database for the date of an object. I get back a string as such: 2011-08-16T19:03:21.000Z (Here’s another one: 2011-08-12T02:13:16.000Z);

Edit: Here is another one that I made August 16th, 2011, at 12:51 PM for testing purposes: 2011-08-16T19:51:24.000Z

I want to convert this date to another format for display purposes. This format may change in the future, so I don’t want to do direct string manipulation. The best thing to do is turn it into an NSDate, and then back to the correctly formatted string. However, I cannot, for the life of me, get the darn string into an NSDate.

- (NSString *)makeDateStringReadable:(NSString *)dateString {
    NSLog(@"The String: %@", dateString);
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"yyyy-MM-ddTHH:mm:ss.zzzz"];
    NSDate *theDate = [formatter dateFromString:dateString];
    NSLog(@"The Date: %@", theDate);
    [formatter setDateFormat:@"yyyy-MM-dd"];
    NSString *finalString = [formatter stringFromDate:theDate];
    [formatter release];
    return finalString;
}

The original string is passed in, and is logged out, but the “The Date:” log always shows null. I’m assuming the format is not correct… but I can’t get it to be correct. I’ve tried using this as a reference as well.

Can I get the aid of a DateFormatter guru? Thank you so much!

  • 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-24T14:26:21+00:00Added an answer on May 24, 2026 at 2:26 pm

    One problem (but possibly not the problem) is that that zzzz is not the right specification for 000Z. The end of the RFC 3339 timestamp is not a four-character timezone specification, but fractional seconds plus a literal "Z". So try changing zzzz to SSS'Z'.

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

Sidebar

Related Questions

I am kinda new to database designing so i ask for some advices or
sorry for any inconveniece caused. Would like to ask about database or rather databinding
What I want to ask is how to select from database record and my
I am storing all my dates in UTC format in my database. I ask
Not sure if I should edit this question or just ask another question in
Bizarre question: is it possible to get the last modified date of a file
Based on the discussion I found here: Database: To delete or not to delete
Hi i have a sorting question to ask. My database has images with Photoname
I have an error in that m String currentDateTimeString = DateFormat.getDateInstance().format(new Date()); Cursor myCursor=db.query(true,
I ask this because at work I am supposed to develop a web-application that

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.