Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. func countDownString(from date: Date, until nowDate: Date) -> String {
  2. let calendar = Calendar(identifier: .gregorian)
  3. let components = calendar
  4. .dateComponents([.day, .hour, .minute, .second]
  5. ,from: nowDate,
  6. to: date)
  7. return String(format: "%02dd:%02dh:%02d:%02ds",
  8. components.day ?? 00,
  9. components.hour ?? 00,
  10. components.minute ?? 00,
  11. components.second ?? 00)
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement