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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:58:59+00:00 2026-05-28T14:58:59+00:00

I am facing issue with proper date retrieval using date formatter.I have saved the

  • 0

I am facing issue with proper date retrieval using date formatter.I have saved the date in the following format:

[dateFormat setDateFormat:@”YYYY-MM-dd HH:mm:ss”];

Now I need to display the saved date in view controller.For the convenience of readability and simplicity,I have retrieved the saved date from database and changed to a short format say January 17,February 18 etc..Here is the implementation code for that:

remind.Date = [[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(statment, 3)];
NSDateFormatter *dateFormat = [[[NSDateFormatter alloc]init]autorelease];
[dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *date = [dateFormat dateFromString:remind.Date];
[dateFormat setDateFormat:@"MMMM dd"];
NSString *dateVal = [dateFormat stringFromDate:date];
remind.Date = dateVal;

Now the date value will be visible as shown in the following snap shot:

enter image description here

All these dates are saved in to an array called grpArray

Now I want to retrieve the complete date of formatted date,when I select the row and navigate to controller where that date is saved,for that in did select row at index path I implemented the following code:

-(void)tableView:(UITableView *)atableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

        ReminderClass *rem = [self.grpArray objectAtIndex:indexPath.section];

        // Instantiate your detail/editor view controller,
        // and pass in the ReminderClass object to be edited.
        ERAddReminderViewController *rdvc = [[[ERAddReminderViewController alloc]initWithReminder:rem]autorelease];

        NSDateFormatter *dateFormat = [[[NSDateFormatter alloc]init]autorelease];
        [dateFormat setDateFormat:@"MMMM dd"];
        [dateFormat setLenient:YES];
        NSDate *date = [dateFormat dateFromString:rem.Date];
        [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
        NSString *dateVal = [dateFormat stringFromDate:date];
        rem.Date = dateVal;

        [self.navigationController pushViewController:rdvc animated:YES];
        rdvc.navigationItem.rightBarButtonItem.title = @"Edit";
}

Now according to the logic I should get the complete date i.e. format specified.Its working fine but got a problem with correct year and time that was originally saved.Please see the following snap shot for clarification:

enter image description here

Now the date as we can see is 1970-01-17 00:00:00

But the actual date which I saved was 2012-01-17 19:40:40

What went wrong with the implementation

Can any one please guide me right

Thanks all in advance 🙂

  • 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-28T14:59:01+00:00Added an answer on May 28, 2026 at 2:59 pm

    What I see is you’re trying to convert a date MMMM dd to a yyyy-MM-dd HH:mm:ss.
    Which ofcourse isn’t possible since the date in the first format doesn’t know the year and time.
    That’s why it’s showing 1970 00:00:00 , the 01-17 are correct (ofcourse)

    You always have to ‘store’ the original date yyyy-MM-dd HH:mm:ss and work with that instead of the formatted one.

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

Sidebar

Related Questions

I am new to MVC and facing one issue. I have a xml file
I am using Appweb server (mini http server) and facing an issue while opening
i am doing a database design using EAV. I am facing an issue when
I am using ASP.NET MVC2 with NHibernate, but am facing an issue. All calls
I'm facing a frustrating issue. I have an application where the scroll wheel doesn't
I am facing the following issue when deploying a com-exposed assembly to my client's.
I am facing issue with the following Json reponse object in the javascript eval
I am facing an issue that is driving me insane. I have one and
Been Facing this issue,I Have as my view <%= form_for(:pin, :url => {:action =>fees})
We are facing an issue where the following check fails intermittently in IE: pseudocode:

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.