sql getdate date only 1

sql getdate date only

-- MS SQL Server
SELECT CAST(getdate() AS date);
SELECT CAST(getdate() AS varchar(10));

Here is what the above code is Doing:
1. We’re creating a variable called `now` and assigning it the value of the current date and time.
2. We’re creating a variable called `today` and assigning it the value of the current date.
3. We’re creating a variable called `today_string` and assigning it the value of the current date as a string.

Now let’s see what happens when we print these variables:

Similar Posts