DATEPART() Function in SQL Server



The DATEPART() function returns a specified part of a date. This function returns the result as an integer value

  1. SELECT DATEPART(yy, '2013/04/25'AS DatePartInt;  
  2.   
  3. SELECT DATEPART(mm, '2013/04/25'AS DatePartInt;  
  4.   
  5. SELECT DATEPART(n, '2013/04/25'AS DatePartInt;  
  6.   
  7. SELECT DATEPART(ss, '2013/04/25'AS DatePartInt;  

0 Comment's

Comment Form

Submit Comment