extension NSDate { func dayOfWeek() -> Int { var interval = self.timeIntervalSince1970; var days = Int(interval / 86400); return (days - 3) % 7; } }