判断文件时间

2016-11-08  本文已影响11人  PZcoder

基础类方法:

//文件时间
+ (BOOL)fileIsOutofDate:(NSString* )filepath
{
    NSDictionary* file_info = [[NSFileManager defaultManager] attributesOfItemAtPath:filepath error:nil];
    NSDate* file_date = [file_info objectForKey:@"NSFileCreationDate"];
    NSDate* today = [[NSDate alloc]init];

    //此处判断30天
    if (fabs([today timeIntervalSinceDate:file_date]) > 30*24*60*60 ) 
    {
        return YES;
    }

    return NO;
}
上一篇 下一篇

猜你喜欢

热点阅读