objective c - How can i convert NSDate to NSString ios? -
objective c - How can i convert NSDate to NSString ios? -
i'm receiving date server next format "/date(1413374176217)/" . tried this
nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"dd-mm-yyyy"] nsdate *datefromstring = [[nsdate alloc] init]; datefromstring = [dateformatter datefromstring:date]; nslog(@"datefromstring = %@",datefromstring);
but doesn't work.
how can convert string?
try this.
nsstring *actdate = @"/date(1326067200000)/"; nsstring *ndate = [[[[actdate componentsseparatedbystring:@"("] objectatindex:1] componentsseparatedbystring:@")"] objectatindex:0]; nsdate *date = [nsdate datewithtimeintervalsince1970:([ndate doublevalue] / 1000)];
ios objective-c nsstring nsdate nsdateformatter
Comments
Post a Comment