Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.95 KB | None | 0 0
  1. if (self / 604800 > 1) {
  2.             let division = Int((self / 604800).rounded())
  3.             return "\(division)w"
  4.         }
  5.         else if (self / 86400 > 1) {
  6.             let division = Int((self / 86400).rounded())
  7.            
  8.             if division == 7 {
  9.                 return "1w"
  10.             }
  11.            
  12.             return "\(division)d"
  13.         }
  14.         else if (self / 3600 > 1) {
  15.             let division = Int((self / 3600).rounded())
  16.            
  17.             if division == 24 {
  18.                 return "1d"
  19.             }
  20.            
  21.             return "\(division)h"
  22.         }
  23.         else if (self / 60 > 1) {
  24.             let division = Int((self / 60).rounded())
  25.            
  26.             if division == 60 {
  27.                 return "1h"
  28.             }
  29.            
  30.             return "\(division)m"
  31.         }
  32.         else {
  33.             let division = Int(self.rounded())
  34.             return "\(division)s"
  35.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement