Introduction:
This article explains how to get all the months in the any Financial Year using C#.
Method- 1
This article explains how to get all the months in the any Financial Year using C#.
Method- 1
public static List<string> GetStringMonthsList(string FinacialYear) { string fist = FinacialYear.Split('-')[0].ToString(); string Second = FinacialYear.Split('-')[1].ToString(); List<string> result = new List<string>(); result.Add("April" + "-" + fist); result.Add("May" + "-" + fist); result.Add("June" + "-" + fist); result.Add("July" + "-" + fist); result.Add("August" + "-" + fist); result.Add("September" + "-" + fist); result.Add("October" + "-" + fist); result.Add("November" + "-" + fist); result.Add("December" + "-" + fist); result.Add("January" + "-" + Second); result.Add("February" + "-" + Second); result.Add("March" + "-" + Second); return result; }
Method- 2
public static SelectList GetMonthsList(string Month) { string months = Month;//2015-2016 string[] parts = months.Split('-'); string fist = parts[0].ToString(); string Second = parts[1].ToString(); var result = new List<SelectListItem>(); result.Add(new SelectListItem() { Text = "April" + "-" + fist, Value = "4" }); result.Add(new SelectListItem() { Text = "May" + "-" + fist, Value = "5" }); result.Add(new SelectListItem() { Text = "June" + "-" +fist, Value = "6" }); result.Add(new SelectListItem() { Text = "July" + "-" + fist, Value = "7" }); result.Add(new SelectListItem() { Text = "August" + "-" + fist, Value = "8" }); result.Add(new SelectListItem() { Text = "September" + "-" + fist, Value = "9" }); result.Add(new SelectListItem() { Text = "October" + "-" + fist, Value = "10" }); result.Add(new SelectListItem() { Text = "November" + "-" + fist, Value = "11" }); result.Add(new SelectListItem() { Text = "December" + "-" + fist, Value = "12" }); result.Add(new SelectListItem() { Text = "January" + "-" + Second, Value = "1" }); result.Add(new SelectListItem() { Text = "February" + "-" + Second, Value = "2" }); result.Add(new SelectListItem() { Text = "March" + "-" + Second, Value = "3" }); return new SelectList(result, "Value", "Text"); }
You shared useful post. Thanks for sharing.
ReplyDeleteSEO Training center in chennai
Nice blog. Keep sharing such a useful post.
ReplyDeleteweb design courses in chennai
Nice blog. Keep sharing such a useful post.
ReplyDeletejava training in chennai
Nice blog. Keep sharing such a useful post.
ReplyDeleteinformix training in chennai
keep sharing .. nice post - struts Training in Chennai
ReplyDeleteInformative blog !! Spring Training in Chennai
ReplyDeleteGreat and useful.A strut is an open source framework and is used for web applications.
ReplyDeleteRegards,
Struts Training in Chennai | Struts course in Chennai | Struts Training institutes in Chennai