1.時(shí)間戳轉(zhuǎn)字符串
創(chuàng)新互聯(lián)建站主營(yíng)鹽都網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,重慶APP開發(fā),鹽都h5微信小程序開發(fā)搭建,鹽都網(wǎng)站營(yíng)銷推廣歡迎鹽都等地區(qū)企業(yè)咨詢
///時(shí)間戳轉(zhuǎn)化為字符轉(zhuǎn)0000-00-00 00:00 + (NSString *)time_timestampToString:(NSInteger)timestamp{ NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:timestamp]; NSDateFormatter *dateFormat=[[NSDateFormatter alloc]init]; [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm"]; NSString* string=[dateFormat stringFromDate:confromTimesp]; return string; }
1.Date轉(zhuǎn)字符串
///date轉(zhuǎn)化為字符轉(zhuǎn)0000-00-00 00:00 + (NSString *)time_dateToString:(NSDate *)date{ NSDateFormatter *dateFormat=[[NSDateFormatter alloc]init]; [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm"]; NSString* string=[dateFormat stringFromDate:date]; return string; }
總結(jié)
以上所述是小編給大家介紹的iOS開發(fā)之時(shí)間戳(或date)轉(zhuǎn)字符串的實(shí)例代碼,希望對(duì)大家有所幫助,如果大家有任何疑問歡迎給我留言,小編會(huì)及時(shí)回復(fù)大家的!