Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func countDownString(from date: Date, until nowDate: Date) -> String {
- let calendar = Calendar(identifier: .gregorian)
- let components = calendar
- .dateComponents([.day, .hour, .minute, .second]
- ,from: nowDate,
- to: date)
- return String(format: "%02dd:%02dh:%02d:%02ds",
- components.day ?? 00,
- components.hour ?? 00,
- components.minute ?? 00,
- components.second ?? 00)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement