iphone - Not able to convert NSString to NSDate -
i'm getting date (thu may 02 10:08:08 +0000 2013) link , stored string. want convert string nsdate.
i'm using code:
nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"yyyy-mmmm-dd hh:mm:ss"]; nsdate *message_date=[formatter datefromstring:str]; nslog(@"message_date ========%@",message_date);
but message_date printing null value.
so please guide me , put sample code.
please try use 1
nsstring *str = @"thu may 02 10:08:08 +0000 2013"; nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"eee mmm dd hh:mm:ss z yyyy"]; nsdate *message_date=[formatter datefromstring:str]; nslog(@"message_date ========%@",message_date);
Comments
Post a Comment