T-SQL Tutorial

GETDATE() Date Function

Getdate() is an date function and returns the current database system timestamp as a datetime. This value is the date of the operating system of the computer on which the instance of SQL Server is running.

GETDATE() Syntax:


GETDATE() Example:

select getdate() as System_date;

2014-02-22 10:59:48.707

SELECT CONVERT (date, GETDATE()) as System_date,
CONVERT (time, GETDATE()) as System_time,
CONVERT (datetime, GETDATE()) as System_datetime,
CONVERT (datetime2, GETDATE()) as System_datetime2;

2014-02-2211:04:10.43000002014-02-22 11:04:10.4302014-02-22 11:04:10.4300000