i getting string web service in format, pubdate:"fri, 19 jul 2013 07:13:44 gmt" want print time in hh:mm:ss format,i.e, want print 07:13:44. how can achieve this?
use :
nsstring *str = @"fri, 19 jul 2013 07:13:44 gmt"; nsdateformatter *df = [[nsdateformatter alloc] init]; [df setdateformat:@"ee, dd mmm yyyy hh:mm:ss z"]; nsdate *date = [df datefromstring:str]; nstimezone* sourcetimezone = [nstimezone timezonewithabbreviation:@"gmt"]; [df settimezone:sourcetimezone]; nsdate *datefromstring = [df datefromstring:str]; [df setdateformat:@"hh:mm:ss"]; // time need nsstring *timeis = [df stringfromdate:date];
Comments
Post a Comment