Link to home
Start Free TrialLog in
Avatar of rodmjay
rodmjayFlag for United States of America

asked on

get January 1, for current year in TSQL

I need a tsql statement that will give me "1/1/[current year]"
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of maradam
maradam

select convert(datetime,convert(varchar(4),year(getdate()))+'0101')
Or simply:
CAST(CONVERT(char(8), GETDATE(), 112) as datetime) - DATEPART(dayofyear, GETDATE()) + 1