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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:06:18+00:00 2026-06-17T12:06:18+00:00

I am in the process of converting a NSString to an NSDate and running

  • 0

I am in the process of converting a NSString to an NSDate and running into an issue where the year is wrong in the final conversion.

My input date is 2013-05-27 03:38:20 +0000 (listed as lastEntry.date in the code below)

My Conversion code is as follows:

//Convert String to NSDate

NSDateFormatter *originalDateFormat = [[NSDateFormatter alloc] init];

[originalDateFormat setDateFormat:@"YYYY-MM-dd hh:mm:ss Z"];
[originalDateFormat setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];

NSDate *originalEndDate = [originalDateFormat dateFromString:lastEntry.date];

NSLog(@"Converted End Date = %@", [originalDateFormat stringFromDate:originalEndDate]);

The Final Output I get is: Converted End Date = 2012-05-27 03:38:20 +0000

I am not sure why I am losing a year during this conversion. In all my research so far it seems the hardest part of this conversion process is making sure the format is correct, and since my output date is in the right format I feel there is another issue else where. Is there something that I am missing or doing wrong?

  • 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-17T12:06:20+00:00Added an answer on June 17, 2026 at 12:06 pm

    Change your date format from YYYY to yyyy.

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

Sidebar

Related Questions

I am in process of converting Visual Basic app into Python Django. Currently, it
I am in the process of converting a static website into one using a
I'm currently in the process of converting an old bash script of mine into
I went through the process of converting mysql_* code into PDO code. I've run
I'm in the process of converting an ASP.Net webform into a User control and
I am in the process of converting a excel work book into a web
I am in the process of converting an OpenGL java application into Objective-C. Here
I am in the process of converting several queries which were hard-coded into the
What is the process of converting win32 application (a small popup window actually) to
Im in the process of converting my rails code which developed in version 2

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.