let dateFormatter = NSDateFormatter()
dateFormatter.timeStyle = NSDateFormatterStyle.NoStyle
let gmtTimeZone = NSTimeZone(abbreviation: "GMT")
dateFormatter.timeZone = gmtTimeZone
dateFormatter.dateFormat = "yyyyMMdd"
var dates = [String]()
let threeMonthAgoComponent = NSDateComponents()
threeMonthAgoComponent.month = -3
var date = NSDate()
let calendar = NSCalendar.currentCalendar()
let lastDate = calendar.dateByAddingComponents(threeMonthAgoComponent, toDate: date, options: NSCalendarOptions(rawValue: 0))
let dayAgoComponent = NSDateComponents()
dayAgoComponent.day = -1
while (date != lastDate) {
date = calendar.dateByAddingComponents(dayAgoComponent, toDate: date, options: NSCalendarOptions.MatchFirst)!
dates.append(dateFormatter.stringFromDate(date))
}
print(dates)