This is how we can get specified quarter by month. Example code
private string returnQuarterPeriod(string month){string strReturn = "";try{int iMonth = DateTime.Parse(month).Month;if (iMonth <= 3){ return "1"; }else if (iMonth >= 4 && iMonth <= 6){ return "2"; }else if (iMonth >= 7 && iMonth <= 9){ return "3"; }else if (iMonth >= 10 && iMonth <= 12){ return "4"; }else{//Something probably is wrongreturn "0";}}catch (Exception ex){throw ex;}return strReturn;}
Hope this helps!
No comments:
Post a Comment