T-SQL Script Output format
   
SELECT CONVERT(VARCHAR(100), GETDATE(), 0) 03  6 2010  4:19PM
SELECT CONVERT(VARCHAR(100), GETDATE(), 1) 03/06/10
SELECT CONVERT(VARCHAR(100), GETDATE(), 2) 10.03.06
SELECT CONVERT(VARCHAR(100), GETDATE(), 3) 06/03/10
SELECT CONVERT(VARCHAR(100), GETDATE(), 4) 06.03.10
SELECT CONVERT(VARCHAR(100), GETDATE(), 5) 06-03-10
SELECT CONVERT(VARCHAR(100), GETDATE(), 6) 06 03 10
SELECT CONVERT(VARCHAR(100), GETDATE(), 7) 03 06, 10
SELECT CONVERT(VARCHAR(100), GETDATE(), 8) 16:23:28
SELECT CONVERT(VARCHAR(100), GETDATE(), 9) 03  6 2010  4:23:40:110PM
SELECT CONVERT(VARCHAR(100), GETDATE(), 10) 03-06-10
SELECT CONVERT(VARCHAR(100), GETDATE(), 11) 10/03/06
SELECT CONVERT(VARCHAR(100), GETDATE(), 12) 100306
SELECT CONVERT(VARCHAR(100), GETDATE(), 13) 06 03 2010 16:24:39:763
SELECT CONVERT(VARCHAR(100), GETDATE(), 14) 16:24:50:823
SELECT CONVERT(VARCHAR(100), GETDATE(), 20) 2010-03-06 16:25:04
SELECT CONVERT(VARCHAR(100), GETDATE(), 21) 2010-03-06 16:25:18.107
SELECT CONVERT(VARCHAR(100), GETDATE(), 22) 03/06/10  4:25:27 PM
SELECT CONVERT(VARCHAR(100), GETDATE(), 23) 2010-03-06
SELECT CONVERT(VARCHAR(100), GETDATE(), 24) 16:26:48
SELECT CONVERT(VARCHAR(100), GETDATE(), 25) 2010-03-06 16:26:55.810
SELECT CONVERT(VARCHAR(100), GETDATE(), 100) 03  6 2010  4:27PM
SELECT CONVERT(VARCHAR(100), GETDATE(), 101) 03/06/2010
SELECT CONVERT(VARCHAR(100), GETDATE(), 102) 2010.03.06
SELECT CONVERT(VARCHAR(100), GETDATE(), 103) 06/03/2010
SELECT CONVERT(VARCHAR(100), GETDATE(), 104) 06.03.2010
SELECT CONVERT(VARCHAR(100), GETDATE(), 105) 06-03-2010
SELECT CONVERT(VARCHAR(100), GETDATE(), 106) 06 03 2010
SELECT CONVERT(VARCHAR(100), GETDATE(), 107) 03 06, 2010
SELECT CONVERT(VARCHAR(100), GETDATE(), 108) 16:28:25
SELECT CONVERT(VARCHAR(100), GETDATE(), 109) 03  6 2010  4:28:35:123PM
SELECT CONVERT(VARCHAR(100), GETDATE(), 110) 03-06-2010
SELECT CONVERT(VARCHAR(100), GETDATE(), 111) 2010/03/06
SELECT CONVERT(VARCHAR(100), GETDATE(), 112) 20100306
SELECT CONVERT(VARCHAR(100), GETDATE(), 113) 06 03 2010 16:29:25:217
SELECT CONVERT(VARCHAR(100), GETDATE(), 114) 16:29:32:543
SELECT CONVERT(VARCHAR(100), GETDATE(), 120) 2010-03-06 16:29:44
SELECT CONVERT(VARCHAR(100), GETDATE(), 121) 2010-03-06 16:29:51.030
SELECT CONVERT(VARCHAR(100), GETDATE(), 126) 2010-03-06T16:29:59.327
SELECT CONVERT(VARCHAR(100), GETDATE(), 130) 21 ???? ????? 1431  4:30:06:780PM
SELECT CONVERT(VARCHAR(100), GETDATE(), 131) 21/03/1431  4:30:21:990PM
   

 

update by 2014-02-13 12:44

1
2
3
select left(REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(100), GETDATE(), 20), '-'''), ' '''), ':'''), 12)
 
--返回 '201402131244'