In Which Year of Hijrah Was Fasting Enjoined?
Question

In which year was fasting enjoined upon the Muslims?
Praise be to Allah.Fasting the month of Ramadan was enjoined in 2 AH, and the Messenger of Allah (peace and blessings of Allah be upon him) fasted nine Ramadans. 
Al-Nawawi (may Allah have mercy on him) said in al-Majmu’ (6/250)” 
“The Messenger of Allah (peace and blessings of Allaah be upon him) fasted Ramadan for nine years, because it was enjoined in Sha’ban 2 AH, and the Prophet (peace and blessings of Allaah be upon him) died in Rabi’ al-Awwal 11 AH.” 
And Allah knows best.