NSDateFormatter用來設置NSDate的格式

-(NSString *)descriptionspa

{orm

    NSDateFormatter *formatter=[[NSDateFormatter alloc]init];ip

    [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; //用來設置NSDate的輸出格式字符串

    NSString *setTime=[formatter stringFromDate:self.time];string

    NSString *setTime=[formatter stringFromDate:[NSDate date]];//用來說本地時間轉換成字符串的形式輸出it

    return [NSString stringWithFormat:@"\ntitle:%@\ntime:%@\ncontents:%@\n",self.title,setTime,self.contents];io

}form

相關文章
相關標籤/搜索