SQL Current Date
-
Posted on November 14, 2010 by Derek Dieter
-
-2
To get the current date in SQL Server use the GETDATE() function. Here is an example:
[cc lang=”sql”]
SELECT CurrentDate = GETDATE()
[/cc]
GetDate() returns a datetime data type value.
There are also other methods in SQL Server that will return the current date. These are less commonly used. In fact, I have never personally had a need to use any of them except GETDATE().
[cc lang=”sql”]
SELECT SYSDATETIME()
SELECT SYSDATETIMEOFFSET()
SELECT SYSUTCDATETIME()
SELECT CURRENT_TIMESTAMP
SELECT GETDATE()
SELECT GETUTCDATE()
[/cc]
Post a comment
- Comments (RSS)
- Trackback
- Permalink