Get current date in milliseconds

前端 未结 12 770
别跟我提以往
别跟我提以往 2020-12-04 10:23

Can any one give me an idea how to get the current date in milliseconds?

12条回答
  •  时光取名叫无心
    2020-12-04 11:11

    An extension on date is probably the best way to about it.

    extension NSDate {
        func msFromEpoch() -> Double {
            return self.timeIntervalSince1970 * 1000
        }
    }
    

提交回复
热议问题