Apple开发_获取文件创建时间

复制/**
 * @brief 获取文件创建时间
 *
 * @param file_path  文件所在的绝对路径
 * @return 文件创建时间
*/
- (NSDate *)file_Creat_Date:(NSString *)file_path {
    NSFileManager *file_mgr = [NSFileManager defaultManager];
    // 这里包含着这个文件的所有相关信息
    NSDictionary *file_attr = [file_mgr attributesOfItemAtPath:file_path error:nil];
    if (file_attr) {
        NSDate *creat_date = [file_attr objectForKey:NSFileCreationDate];
        if (creat_date) {
            return creat_date;
        }
    }
    return nil;
}
posted @   CH520  阅读(67)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决
· 提示词工程——AI应用必不可少的技术
点击右上角即可分享
微信分享提示
哥伦布
15°
01:09发布
哥伦布
01:09发布
15°
西南风
1级
空气质量
相对湿度
56%
今天
小雨
8°/22°
周六
多云
11°/23°
周日
大雨
15°/22°