0%

IOS开发:生成时间字符串

//时间标记字符串生成

-(NSString*)TimeStamp

{

    NSDate *today = [NSDate date];

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];

    [dateFormatter setDateFormat:@”yyyy-MM-dd hh:mm:ss”];

    NSString *strDate = [dateFormatter stringFromDate:today];

    NSLog(@”Time: %@”,strDate);

    return strDate;

}