Article

Get Date, Day, Month, Year, Hours, Minutes, Seconds From Current Date in SQL Server

05 Jun 2015 Kamal Pratap
0 Comments 1488 Views



Here We explain How To Get Date, Day, Month, Year, Hours, Minutes, Seconds From Current Date in SQL Server. You can also use this script to perform different type of Query.

Get Date, Day, Month, Year, Hours, Minutes, Seconds From Current Date in SQL Server

SQL SERVER :

SELECT CONVERT(VARCHAR(10),GETDATE(),101) OnlyDate,DAY(GETDATE()) AS OnlyDay,MONTH(GETDATE())
 AS OnlyMonth,YEAR(GETDATE()) AS OnlyYear,DATEPART(HOUR, GETDATE()) AS OnlyHour,DATEPART(MINUTE, 
GETDATE()) AS OnlyMinute,DATEPART(SECOND, GETDATE()) AS OnlySecond

 

Kamal Pratap

I have 6+ years experience in .Net technologies like Asp.Net, C#, WCF, Web Services, SQL Server, Ajax, LinQ. Currently I am working in Netcarrots Loyalty Services as a Software Developer.

Comments

No coments found to display!

Leave a Comment