Observed associations between breastfeeding and reduced risk of type 2 diabetes in adulthood may be confounded. We examined if the duration of breastfeeding in infancy was associated with the risk of type 2 diabetes in adulthood after adjustment for a range of pre- and post-natal risk factors. We prospectively followed 6,044 individuals from the Copenhagen Perinatal Cohort born 1959-1961. Duration of any breastfeeding (≤0.5, >0.5-1, >1-2, >2-4, >4 months) was assessed at the infant's 1-year health examination. We estimated hazard ratios (HR) with 95% confidence intervals (CI) for type 2 diabetes (at age ≥30 years, 237 persons) by breastfeeding duration without and with adjustment for parental social status and education, maternal pre-pregnancy BMI, maternal diabetes and smoking during pregnancy, gestational weight gain, parity, preterm birth, birth weight, sex, and body mass index (BMI) at ages 7 and 41-43 years. In the unadjusted analysis, compared with infants breastfed for ≤0.5 month, those breastfed for >4 months had a 51% reduced risk of type 2 diabetes (HR=0.49; 95% CI: 0.32-0.75). After the stepwise adjustment for putative early life confounders, this was attenuated to a non-significant 31% reduced risk (HR=0.69; 95% CI: 0.44-1.07). Adjustment for childhood and adulthood BMI minimally changed the results. We found that the inverse association between the duration of breastfeeding and risk of type 2 diabetes in adulthood is considerably weakened and no longer significant after adjustment for prenatal and postnatal factors in the infant and mother.