• 时间戳转时间


         NSString *curren = [self timeWithTimeIntervalString:time];

    - (NSString *)timeWithTimeIntervalString:(NSString *)timeString

    {

        NSTimeInterval time=[timeString doubleValue]+28800;//因为时差问题要加8小时 == 28800 sec

        NSDate *detaildate=[NSDate dateWithTimeIntervalSince1970:time];

        NSLog(@"date:%@",[detaildate description]);

        //实例化一个NSDateFormatter对象

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

        //设定时间格式,这里可以设置成自己需要的格式

        [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];

        NSString *currentDateStr = [dateFormatter stringFromDate: detaildate];

        return currentDateStr;

    }

  • 相关阅读:
    Rocket
    Rocket
    Rocket
    Rocket
    Rocket
    PHPstorm快捷键大全
    PHP命名规则
    第二章:第2章PHP基础语法
    第一章:初识PHP
    jQuery适用技巧笔记整合
  • 原文地址:https://www.cnblogs.com/liaolijun/p/6767451.html
Copyright © 2020-2023  润新知