获取当前日期,以毫秒为单位 [英] Get current date in milliseconds
本文介绍了获取当前日期,以毫秒为单位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有人能给我一个想法如何获得当前日期毫秒?
Can any one give me an idea how to get the current date in milliseconds?
推荐答案
有几种方法虽然我个人最喜欢的是:
There are several ways of doing, although my personal favorite is:
CFAbsoluteTimeGetCurrent();
您可以阅读有关此方法的更多信息这里。您还可以创建一个NSDate对象,并通过调用 timeIntervalSince1970 ,它返回 seconds 自1/1970以来:
You can read more about this method here. You can also create a NSDate object and get time by calling timeIntervalSince1970 which returns the seconds since 1/1/1970:
NSTimeInterval timeInSeconds = [[NSDate date] timeIntervalSince1970];
干杯,
Pawel
Cheers, Pawel
这篇关于获取当前日期,以毫秒为单位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文