Monday, 14 November 2016

SQL SERVER CONVERT FUNCTION

SQL SERVER CONVERT FUNCTION

--HI VIEWERS, today we are looking at the CONVERT function for dates

-- the convert function will be used to change what is displayed from a standard date and time value

--here we go

SELECT GETDATE() AS [GET DATE & TIME NOW],CONVERT(date,GETDATE()) AS [GET DATE CONVERSION];

--in the convert function the data type is stated before adding a comma and inserting the date value

--which in this case is GETDATE() which displays the current date and time

--I will click !Execute now or press (F5) to run the code.

--you can see when comparing the results listed below that the conversion has stripped out all

--of the time data.

--that is it.

No comments:

Post a Comment