How to Extract Only Date from Getdate in SQL Server
Hi friends, in this post we will learn How to Extract Only Date from Getdate in SQL Server or you can say that How to return the date part only from a SQL Server datetime. Sometime we have requirement of only date part from our datetime datatype or getdate() function.
Earlier we had discussed about: #1045 – Access denied for user ‘root’@’localhost’ (using password: NO), AlwaysOn Availability Groups SQL Server, SQL Server Schema Ownership, Date and Time Data Type in SQL Server 2008 and Configure SSL Connections on Report Server-HTTPS
--DATE DIVIDED BY HYPHEN-- SELECT CONVERT(DATE, GETDATE()) GO --DATE DIVIDED BY HYPHEN-- SELECT CAST(GETDATE() AS DATE) GO --DATE WITHOUT HYPHEN-- SELECT CONVERT(INT, CONVERT(VARCHAR(10), GETDATE(), 112)) GO