Loading ...

Get first and last day of the year in sql | CodeAsp.Net

Get first and last day of the year in sql

 /5
0 (0votes)

In this blog I will explain how to get first and last day of the year in sql. Below is the code snippet.

GO

DECLARE @Date DATETIME

SET @Date = '2009-05-30 10:20:27.220'

SELECT CONVERT(DATETIME, DATEDIFF(d, 0, @Date)) as [Date]

GO

--Output

Date

-----------------------

2009-05-30 00:00:00.000

 

 

 

Happy Reading.!

 

 

 

Comments (no comments yet)

Top Posts