Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting current system time in SQL Server

How do I get current system time in SQL Server?

like image 648
user223541 Avatar asked Dec 22 '09 05:12

user223541


2 Answers

Use the GETDATE() function

SELECT GETDATE()
like image 118
OMG Ponies Avatar answered Oct 13 '22 17:10

OMG Ponies


CURRENT_TIMESTAMP is ANSI compliant and equivalent to GETDATE()

Otherwise, you have a plethora of functions as mentioned in SQL Server 2008 BOL here (with link for SQL Server 2005 too).

I think marc_s might have missed 1 or 2 ;-)

like image 44
gbn Avatar answered Oct 13 '22 18:10

gbn