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!!!!
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!!!!
No comments:
Post a Comment