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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -