c time_t 和 oc NSDate 的转换

1:time_t 转 oc NSDate

time_t some_time_t=NULL;
NSDate *someDate = [NSDate dateWithTimeIntervalSince1970:some_time_t];

2: NSDate 转 time_t

time_t unixTime = (time_t) [[NSDate date] timeIntervalSince1970];

- (NSTimeInterval)timeIntervalSince1970

  

参考:http://stackoverflow.com/questions/2997062/how-to-convert-nsdate-into-unix-timestamp-iphone-sdk

http://stackoverflow.com/questions/2954733/converting-a-time-t-to-nsdate-object

相关文章:

  • 2022-12-23
  • 2021-11-22
  • 2022-01-19
  • 2022-01-28
  • 2021-09-22
  • 2022-12-23
  • 2022-02-10
猜你喜欢
  • 2021-11-01
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
相关资源
相似解决方案