Back to Top

how to substring the time and date to date only

SQL Server Query :


  • To get only the Month from a  given string of datetime


                   SELECT DATEPART(MM, created_date))



  • To get only the Year from a  given string of datetime 


                      SELECT  CONVERT(VARCHAR(4), created_date, 120)

0comments

Post a Comment