Finds Start of the month with given date
CREATE FUNCTION [dbo].[StartOfMonth] ( @date datetime ) RETURNS datetime AS BEGIN return DATEADD(M,-1,DATEADD(mm, DATEDIFF(m,0,@date)+1,0)) END
Finds Start of the month with given date
CREATE FUNCTION [dbo].[StartOfMonth] ( @date datetime ) RETURNS datetime AS BEGIN return DATEADD(M,-1,DATEADD(mm, DATEDIFF(m,0,@date)+1,0)) END
Why do a need a function for this? You can do this using a calculated field. 🙂
HRNET calculated field does not allow this function stright away, you need to write this in the field anyway.
Anyway, I used this function not in HRNET, but in SQL Server procedures, in the background.