// Date is converted to string + (nsstring *) datetostring :( nsstring *) formatter date :( nsdate *) Date {nsdateformatter * dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat: formatter]; return [dateformatter stringfromdate: date];} // converts a string-type Timestamp to a time + (nsstring *) datestringtostring :( nsstring *) datestr {If ([datestr iskindofclass: [nsnull class]) {return nil;} else {nsinteger time = [datestr intvalue]; nsdate * Date = [nsdate datewithtimeintervalsince1970: Time]; nsstring * timestr = [nsstring stringwithformat: @ "% @", date]; nsange rang; rang. location = 0; O rang. length = 10; nsstring * needtime = [timestr substringwithrange: rang]; return needtime ;}// convert the date from the original format to the required format + (nsstring *) convertdateformatter :( nsstring *) sourceformatter targetformatter :( nsstring *) targetformatter datestring :( nsstring *) datestring {nsdateformatter * dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat: sourceformatter] nsdate * Date = [dateformatter datefromstring: datestring]; [dateformatter setdateformat: targetformatter]; return [dateformatter stringfromdate: date];} // converts a date string to date + (nsdate *) stringtodate :( nsstring *) formatter datestring :( nsstring *) datestring {nsdateformatter * dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat: formatter]; return [dateformatter datefromstring: datestring];}