Guest User

Untitled

a guest
Jun 25th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. let formatter = DateFormatter()
  2. formatter.dateFormat = "yyyy-MM-dd HH:mm XXX"
  3.  
  4. let from = zoneFormatter.date(from: "2018-03-25 00:00 +00:00")!
  5. let to = zoneFormatter.date(from: "2018-03-26 00:00 +00:00")!
  6.  
  7. let components = Calendar.current.dateComponents([.month, .day, .hour, .minute], from: from, to: to)
  8. // components is 1 day, 1 hour, because I am in UK and Daylight Savings started on 25 March.
Add Comment
Please, Sign In to add comment