Get financial year using C# | Coding Cluster - using asp.net, c#, mvc 4, iphone, php, ios, javascript, in asp.net mvc 3 & more
 

Get financial year using C#

Monday

  Get financial year using C# :

// The following C# function used to get the Financial year from the given date
       public static string GetFinancialYear(string cdate)
        {
            string finyear = "";
            DateTime dt = Convert.ToDateTime(cdate);
            int m = dt.Month;
            int y = dt.Year;
            if (m > 3)
            {
                finyear = y.ToString().Substring(2, 2) + "-" + Convert.ToString((y + 1)).Substring(2,2);   
                //get last  two digits (eg: 10 from 2010);
            }
            else
            {
                finyear = Convert.ToString((y - 1)).Substring(2, 2) + "-" + y.ToString().Substring(2, 2);
            }
            return finyear;
       }


1 comments:

Srikanto Bormon said...

I really glad to read this informative post, thank u to share-inventhistory
Clothing
Communication
Entertainment
Electric
Financial
Food Preparation
Green Technology
Software
Warfare
Transportation
Instruments
Office

Post a Comment

Share your thoughts here...

 
 
 

RECENT POSTS

Boost

 
Blogger Widgets