时间戳

获取当天零点的时间戳

- (NSString *)getZeroWithTimeInterverl{
    
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:[[NSDate date] timeIntervalSince1970]];
    //格式化时间戳
    NSDateFormatter *dateFomater = [[NSDateFormatter alloc]init];
    dateFomater.dateFormat = @"yyyy年MM月dd日 HH:mm:ss";
    NSString *nowDateStr = [dateFomater stringFromDate:date];
    NSLog(@"nowDateStr===%@",nowDateStr);

    NSString *result = [NSString stringWithFormat:@"%zd",(int)[date timeIntervalSince1970]];
    
    return result;
}

你可能感兴趣的:(时间戳)