时间戳

2017-12-12  本文已影响15人  itclimb

获取当天零点的时间戳

- (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;
}
上一篇下一篇

猜你喜欢

热点阅读