The default datetime format of the Chinese version of SQL Server is yyyy-mm-dd thh: mm: Ss. Mmm.
For example:
Select getdate ()
11:06:08. 177
This is inconvenient for people who want to migrate data between different databases or get used to the Oracle Date Format YYYY-MM-DD hh24: MI: Ss.
I sorted out the date format conversion methods that may be frequently used in SQL Server:
Example:
Select convert (varchar, getdate (), 120)
11:06:08
Select Replace (replace (convert (varchar, getdate (), 120 ),'-',''),'',''),':','')
20040912110608
Select convert (varchar (12), getdate (), 111)
2004/09/12
Select convert (varchar (12), getdate (), 112)
20040912
Select convert (varchar (12), getdate (), 102)
2004.09.12
Other date format conversion methods that are not commonly used:
Select convert (varchar (12), getdate (), 101)
09/12/2004
Select convert (varchar (12), getdate (), 103)
12/09/2004
Select convert (varchar (12), getdate (), 104)
12.09.2004
Select convert (varchar (12), getdate (), 105)
12-09-2004
Select convert (varchar (12), getdate (), 106)
12 09 2004
Select convert (varchar (12), getdate (), 107)
09 12,200 4
Select convert (varchar (12), getdate (), 108)
11:06:08
Select convert (varchar (12), getdate (), 109)
09 12, 2004 1
Select convert (varchar (12), getdate (), 110)
09-12-2004
Select convert (varchar (12), getdate (), 113)
12 09 2004 1
Select convert (varchar (12), getdate (), 114)
11:06:08. 177