NSDateFormatter Does not convert correctly

Posted by deamonsarea on Stack Overflow See other posts from Stack Overflow or by deamonsarea
Published on 2010-04-22T09:53:01Z Indexed on 2010/04/22 10:33 UTC
Read the original article Hit count: 200

Filed under:

Hi,

I have a NSString which is passed from an xml feed........

NSString *strDate =@"Thu, 22 Apr 2010 10.30 am CEST";

I'm currently using this code to format the date........

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"EEE, dd MMM yyyy hh:mm a vvvv"];
    NSDate *myDate = [dateFormatter dateFromString:date];
    [dateFormatter setDateFormat:@"HH"];
    NSLog(@"%@", [dateFormatter stringFromDate:myDate]);

I want to format my string only to display only hours and currently I'm getting value like this.

strDate =@"2010-04-10 14:00:00 +0530";

Can anyone please help me with this?......

© Stack Overflow or respective owner

Related posts about iphone