Method 1 Code as follows SELECTconvert (char (6), getdate (), 112) method 2 Code as follows select * from table name whereConvert (varchar (100), Date Field, 23) use the Convert () function: selectconvert (char (10), GetDate (), 120) asDate * 3rd parameters are used to set the date type
Method 1 Code as follows SELECT convert (char (6), getdate (), 112) method 2 Code as follows select * from table name where Convert (varchar (100), Date Field, 23) = '2017-12-15' use the Convert () function: select convert (char (10), GetDate (), 2013) as Date * 120 parameters are used to set the Date type
Method 1
The Code is as follows:
SELECT convert (char (6), getdate (), 112)
Method 2
The Code is as follows:
Select * from table name where Convert (varchar (100), Date Field, 23) = '2017-12-15'
Use the Convert () function:
Select convert (char (10), GetDate (), 120) as Date
* The 3rd parameters are used to set the display style of the date data. The following describes several style parameters:
100mm dd yyyy
101/dd/yyyy
102 yyyy. mm. dd
103 dd/mm/yyyy
106 dd mm yyyy
108 hh: mi: ss (time)
111 yyyy/mm/dd
112 yyyymmdd
120 yyyy-mm-dd
,