Hello Forum
I have created the following function to set the start of the financial year. What I need to know is how to use this function in order to perform date functions within a database where the start of the financial year is week 1: -
Create FUNCTION [dbo].[FinencialYearStartDate]
(@Date DATETIME) RETURNS VARCHAR(10) AS
BEGIN
DECLARE @RetVal varchar(10)
Declare @Month int
Declare @Year int
case
when month(getdate()) > 3
SET @RetVal = (convert(datetime, cast(year(getdate()) as varchar) + '/04/01'))
else
SET @RetVal = (convert(datetime, cast(year(getdate()) - 1 as varchar) + '/04/01'))
End
Return @RetVal
End
Please click "Mark As Answer" if my post helped. Tony C.