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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:54:44+00:00 2026-06-10T21:54:44+00:00

Update: I was able to get the date converted from the server json to

  • 0

Update: I was able to get the date converted from the server json to 2012/09/05 10:45

    NSDateFormatter *df = [[NSDateFormatter alloc] init];
    [df setDateFormat:@"yyyy-MM-dd HH:mm:ss"];

NSDateFormatter *df = [[NSDateFormatter alloc] init];
         [df setDateFormat:@"YYYY-MM-dd HH:mm:ss"];


    for (NSString *slotKey in myslots.allKeys) {
        NSDictionary *slot = [myslots valueForKey:slotKey];

        for (myDays in slot){

            if ([[self.myDays objectForKey:@"isReservable"] isEqualToNumber:[NSNumber numberWithInt:1]]){

                NSDate *newDate = [df dateFromString:[self.myDays objectForKey:@"begin"]];
                if (newDate){
                    [self.timesArray addObject:newDate];

                }
                NSLog(@"these are the returned newdates: %@",newDate);
                NSLog(@"This is the timesArray: %@", self.timesArray);
            }


        }        
    }

My NSLog of These are still returning null and my This is the timesArray is ()
I am not understanding what is wrong. Thanks for the help.

  • 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-10T21:54:46+00:00Added an answer on June 10, 2026 at 9:54 pm

    Are you sure that your inputs are valid?

    Also, your first log only says that the date formatter got allocated–not that it will produce results for your inputs.

    Ran a quick test, it looks like your problem is in the timezone portion of the date. The following code will return: date is 2012-10-04 16:15:00 +0000

    NSDateFormatter *df = [[NSDateFormatter alloc] init];
    [df setDateFormat:@"YYYY-MM-dd HH:mm:ss V"];
    NSDate* date = [df dateFromString:@"2012-10-04 09:15:00 PT"];
    NSLog(@"date is %@", date);
    

    You can check explicitly to see if the date formatter can get a date from your string like this:

        __autoreleasing NSDate* date2 = nil;
        NSRange dateRange = NSMakeRange(0, [@"2012-10-04 09:15:00 PT" length]);
        __autoreleasing NSError* err = nil;
    
        BOOL canMakeDate = [df getObjectValue:&date2 forString:@"2012-10-04 09:15:00 PT" range:&dateRange error:&err];
        NSLog(@"could get a date %@, from range %@. Got %@", canMakeDate ? @"YES" : @"NO", NSStringFromRange(dateRange), date2);
    

    Since the date string is coming from server-side I would suggest investigating how it’s sending down timezones and change them manually on your end. Not pretty but regexs are your friend.

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

Sidebar

Related Questions

I need to be able to update my app from within the app itself.
I have the below Json (wf.json) { workflow:{ template:Analysis1, start:{ instance:HDA_run1, user:symtest, date:3-Mar-2012, timestamp:1330948220475
I am trying to get an event calendar working from json data. I just
I need to be able to update the quantity of products in the user
I need to be able to update my config file programmatically and change my
I am creating a software application that is able to update itself. After the
I dont understand why I am not able to update a field on the
I was wondering how you might be able to update a CURL (PHP) request
I want to be able to add and update certain information. Now it was
I want to be able to insert and update rows with embedded carriage returns

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.