Does anyone know how do I convert the following SQL Statement into ddmmyy
without has any delimiter?
convert(varchar(10), '2015-06-01 00:00:00.000', ??)
For example 2015-06-01 (yyyy-mm-dd)
want to convert as 010615 (ddmmyy)
.
你可以使用Convert
函数为它提供样式:
SELECT REPLACE(CONVERT(varchar(10), GETDATE(), 5), '-', '')
你可以使用这样的东西
SELECT (REPLACE(CONVERT(nchar(8), GETDATE(), 3), '/', ''))
SELECT FORMAT(GETDATE(), 'ddMMyy')
使用MS SQL Server 2012进行测试。您可以使用自己选择的自定义格式。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.