For example if I execute the code below under my Windows 7-I have PHP running under windows 7/IIS.
echo time() I will get this 1304972050
How can I get the same result in MSSQL?
The CURRENT_TIMESTAMP function returns the current date and time, in a 'YYYY-MM-DD hh:mm:ss. mmm' format. Tip: Also look at the GETDATE() function.
The Microsoft Drivers for PHP for SQL Server enable integration with SQL Server for PHP applications. The drivers are PHP extensions that allow the reading and writing of SQL Server data from within PHP scripts.
SQL Server GETDATE() Function The GETDATE() function returns the current database system date and time, in a 'YYYY-MM-DD hh:mm:ss. mmm' format. Tip: Also look at the CURRENT_TIMESTAMP function.
In SQL, CURRENT_TIMESTAMP is used to extract the current date and time. It takes no argument and returns the datetime value.
SELECT DATEDIFF(ss, '1/1/1970 05:00:00', GETUTCDATE())
Should do.
UPDATED per comment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With