What is equivalent to php time () in mssql?

For example, if I execute the code below under my Windows 7, my PHP works under Windows 7 / IIS.

echo time() I will get this 1304972050 

How can I get the same result in MSSQL?

+5
source share
3 answers
 SELECT DATEDIFF(ss, '1/1/1970 05:00:00', GETUTCDATE()) 

Have to do.

UPDATED for comment.

+10
source

To get time in sql:

 SELECT DATEDIFF(s,'19700101 05:00:00:000',GETUTCDATE()) 
+4
source

You will not get this out of the box, but you can find functions defined on sql servers, for example. http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=66858 .

+1
source

All Articles