美文网首页
iOS时间戳转时间

iOS时间戳转时间

作者: 没错就是豪哥灬 | 来源:发表于2017-03-13 14:04 被阅读53次

    NSString*orderDate = @"1489373937000";

    [self timestampSwitchTime:orderDate];

    -(NSString*)timestampSwitchTime:(NSString*)timestamp

    {

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

    [formatter setDateStyle:NSDateFormatterMediumStyle];

    [formatter setTimeStyle:NSDateFormatterShortStyle];

    [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];

    NSDate*timeDate = [NSDate dateWithTimeIntervalSince1970:[timestamp floatValue]/1000];

    NSString*confromTimespStr = [formatter stringFromDate:timeDate];

    return confromTimespStr;

    }

    相关文章

      网友评论

          本文标题:iOS时间戳转时间

          本文链接:https://www.haomeiwen.com/subject/wvwfnttx.html