Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
355 views
in Technique[技术] by (71.8m points)

objective c - Issues with initWithFormat value from server

Please how do I make my initWithFormat to display in as 8:00am - 2:30pm?

Help please!! I have already added "dd-MM-yyyy 'at' h:mm:ss a"

//opening
    NSString *startDate= ((Timeslot *)[self.timeslots objectAtIndex:i]).startDateTime;
    NSArray *split =[startDate componentsSeparatedByString: @"T"];
    NSString* clock =[split objectAtIndex: 1];
    NSArray *aux= [clock componentsSeparatedByString:@":"];
    NSString *startTime = [[NSString alloc] initWithFormat:@"%@:%@",[aux objectAtIndex:0],[aux objectAtIndex:1]];

    NSArray *st = [sttHour componentsSeparatedByString: @":"];
    if([[st objectAtIndex:0] integerValue] < [[aux objectAtIndex:0] integerValue])
    {
        if(![self.openings containsObject:startTime])
        {
            [self.openings addObject:startTime];
            [self.closings addObject:startTime];
        }

        [self.frees addObject:startTime];
    }

This is the value I am getting from the server:

Timeslot =  {
            endDateTime = "2014-07-25T16:00:00";
            id = 1344;
            startDateTime = "2014-07-25T14:00:00";
        };
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...