Need sql help to caluculate fiscal year based on todays date
Posted on 2013-02-06
I need help in caluculating fiscal year based on a meetingdate as well the date when the user is running the query
like I have the formula to caluculate the fiscal years based on meetingdate as below:
declare @meetingdate as varchar(20)
print YEAR(DATEADD(month, 6 + DATEDIFF(month, 0,
and the result is 2006 and now the user wants to compae this with the date he's running the query say for example if he's running the above query after the fiscalyear which is on 07/01/2013 then the result of the fiscalyear should be 2007 and if he's running it before like 6/13/2013 then the result should be 2006.He wants the results based on the fiscalyears of the meetingdate but compare with when he's running the query also. I hope I explained it well if not I can kindly let me know.