// 得到当前本地时间,13位,整形

+ (long long)gs_getCurrentTimeToMilliSecond {

    double currentTime = [[NSDate date] timeIntervalSince1970] * 1000;

    long long iTime = (long long)currentTime;

    return iTime;

}

 

//得到当前时间相对1970时间的字符串,精度到秒,返回10位长度字符串

+ (NSString *)gs_getCurrentTimeBySecond {

    double currentTime =  [[NSDate date] timeIntervalSince1970];

    NSString *strTime = [NSString stringWithFormat:@"%.0f",currentTime];

    return strTime;

}

 

/** 得到当前时间相对1970时间的字符串,精度到毫秒,返回13位长度字符串*/

+ (NSString *)gs_getCurrentTimeStringToMilliSecond {

    double currentTime =  [[NSDate date] timeIntervalSince1970]*1000;

    NSString *strTime = [NSString stringWithFormat:@"%.0f",currentTime];

    return strTime;

}

相关文章:

  • 2021-08-06
  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
  • 2023-02-06
  • 2021-11-18
  • 2022-02-17
猜你喜欢
  • 2022-02-04
  • 2022-03-10
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案