ios - date format issues after updating iPad version 8.3 -
date format issues after updating ipad version 8.3 below code return nil value works fine in simulator , ipod
-(nsstring *)dateformat:(nsstring *)str{ nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"yyyy/mm/dd hh:mm:ss zzz"]; nsdate *datefromstring = [[nsdate alloc] init]; datefromstring = [dateformatter datefromstring:str]; //problem here when call method simulator , ipod runs //and returns 2015-01-27 00:27:48 +0000 in case of ipad(ios 8.3) return nil nsdateformatter* df = [[nsdateformatter alloc] init]; [df setdatestyle:nsdateformattermediumstyle]; [df settimestyle:nsdateformattershortstyle]; nsstring* mystring = [df stringfromdate:datefromstring]; return mystring; } //code call above method date string return web service [self dateformat:@"2015/01/26 16:27:48 pst"];
check input string date format.
should in format: - yyyy/mm/dd hh:mm:ss zzz
Comments
Post a Comment