var dateFormatter:NSDateFormatter = NSDateFormatter(); dateFormatter.dateFormat = "yyyy/MM/dd"; var dateString:String = dateFormatter.stringFromDate(NSDate()); var dates:[String] = dateString.componentsSeparatedByString("/") currentYear = dates[0].toInt()! currentMonth = dates[1].toInt()! currentDay = dates[2].toInt()!