- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试获取当前毫秒数,根据 Google 上的所有问题,我应该使用 NSDate 的 timeIntervalSince1970 属性
但是我已经这样做了:
var startTime = NSData()
and then
startTime. timeIntervalSince1970
and
startTime. timeIntervalSince1970()
但是好像已经没有属性(property)了,对吧?
如果是,请问替换的是什么?
最佳答案
错误是:NSDate
而不是 NSData
。
另外“.”后面不应该有空格?
var 开始时间 = NSDate()让间隔 = startTime.timeIntervalSince1970
来自 Apple 文档:
var timeIntervalSince1970: NSTimeInterval { get }
This property’s value is negative if the date object is earlier than January 1, 1970 at 12:00 a.m. GMT.
关于ios - swift 中的 timeIntervalSince1970 属性在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32083681/
我正在尝试计算从一个日期到另一个日期的天数,并且找到了两种计算方法。 第一个使用 NSDateComponents 如下: NSCalendar *gregorianCalendar = [[NSCa
我正在尝试找出我们现在是多少毫秒。我找不到以毫秒为单位返回忽略日期的时间的方法,所以我想我可以根据 timeIntervalSince 1970 方法返回的值来计算它。 我这样做了: NSLog(@"
我有一个 NSManagedObject 对象: @NSManaged public var timestamp: NSDate 我需要两者之间的时间间隔,所以我实现了: let interval =
我是一名优秀的程序员,十分优秀!