Get financial year


get the financial year from current date, financial year is used in various official reports.

Get financial year



hi friends,

some times we want the financial year like 2009-10 when we working with projects like financial accounts,banking etc,

beacuse of financial year in between march to february

so here i show out a function to give financial year from current date




String cdate="12/20/2009";


// and you want the financial year 2009-10
//here i create a function to get date and return financial year

//in this function if you pass any date of march09 month then you will get 2009-10
//if you have da of feb 2009 month then you will get 2008-09

public string GetFinYear(string sdate)
{
string finyear = "";
DateTime s = Convert.ToDateTime(sdate);

int m = s.Month;
int y = s.Year;
if (m > 3)
{
finyear = y.ToString() + "-" + Convert.ToString((y + 1));
}
else
{
finyear = Convert.ToString((y - 1)) + "-" + y.ToString();
}
return finyear;

}


Related Articles

More articles: Get Year Get year from date financial year C#

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: