Using GETDATE () in the SQL Server date function to get the current date, the following will show you how to get the date using the SQL Server date function.
But what if we just need to get the current date, do not need the time part, or do not need the date as long as the time part, or I want as long as the date in the field appears in some form, what should I do?
You can use the CONVERT (varchar), GETDATE (), 120) method to implement, where varchar (10) Defines the length of the field you want, of course, the length of the different return will not, if we just date part, set to 10 is exactly the date length , if set to 19, you can read the time section exactly.
Now we introduce the parameters of the last generation, respectively, the parameters of the generation and the results of the examples are explained:
SQL Server gets the current date in the specified format