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,589
  • 2
  • 19
  • 33

0 Answers0