I have solved this
int CurrentMonth = Convert.ToInt32(DateTime.Today.Month)
int CurrentDate = Convert.ToInt32(DateTime.Now.Day);
int CurrentYear = Convert.ToInt32(DateTime.Now.Year); if(! (CurrentMonth == Convert.ToInt32(obj.Challan_Date.Month) && CurrentYear == Convert.ToInt32(obj.Challan_Date.Year) ))
{
if (CurrentDate > 5)
{
throw new DataException("Previous Months challan can not be inserted after 5th of every month.");
}
}