Thursday 10 August 2017

How to get Financial Year from provided date programatically in C#?

We can use below code to get Financial year start date and end date from supplied date.

 Public void getFY(DateTime dt)
        {
            string period = "";
            DateTime FYStart, FYEND;

            int year = dt.Year;
            int month = dt.Month;

            if (month < 4)
            {
                FYStart = new DateTime((year - 1), 4, 1);
                FYEND = new DateTime(year, 3, 31);                
            }
            else
            {
                FYStart = new DateTime(year, 4, 1);
                FYEND = new DateTime(year + 1, 3, 31);                
            }
        }

Hope this helps!!!!
Related Posts Plugin for WordPress, Blogger...