5

Getting Issue:

Double value cannot be converted to Int because the result would be greater than Int.max

While converting date to time Interval

 extension Date {
   var millisecondsSince1970:Int {
    return Int((self.timeIntervalSince1970 * 1000.0).rounded())
  }

  init(milliseconds:Int) {
    self = Date(timeIntervalSince1970: TimeInterval(milliseconds / 
  1000))
 }
Salman Ghumsani
  • 3,647
  • 2
  • 21
  • 34

0 Answers0