//将剪切的时间字符串转换为date类型
- (ns date * (信号转换数据帧时间表) : (ns字符串* )时间
{
//设置时间格式
nsdateformatter * date formatter=[ nsdateformatteralloc ] init;
[ dateformattersetdateformat : @ ' hh : mm ' ]
ns date * desdate=[ dateformatterdatefromstring : time ]; //string的格式必须与所需的date格式相同。 例如,如果想要“18:30”格式的日期,我的字符串的格式是“18336030”,不能是“2017-3-24183360:00”格式或其他格式
返回灾难;
}
将Date数据转换为指定格式的字符串
-(nsstring* ) getstrformatterbydate 3360 (ns date * ) date0
nsdateformatter * date formatter=[ nsdateformatteralloc ] init;
[ dateformattersetdateformat : @ ' hh : mm ' ]
ns string * datestr=[ dateformatterstringfromdate 3360 date ]; //date格式没有要求。 例如,date是2017-3-24 18:30:00,我想要的string是“18:30”,可以直接转换
返回数据;
}