数据库的日期格式转换
发布时间:2006-10-14 2:44:51   收集提供:gaoqian
只要在convert中指定日期格式的代号就够了,如:

select convert(char(20),getdate(),101)
select emp_id,convert(char(20),hire_dt,101) from employee


-----------------------------------------------------

日期格式          代号
-------------------- -----------
04/05/2000          101

-------------------- -----------
2000.04.05          102

-------------------- -----------
05/04/2000          103

-------------------- -----------
05.04.2000          104

-------------------- -----------
05-04-2000          105

-------------------- -----------
05 Apr 2000         106

-------------------- -----------
Apr 05, 2000         107

-------------------- -----------
11:33:24           108

-------------------- -----------
Apr 5 2000 11:33:24     109

-------------------- -----------
04-05-2000          110

-------------------- -----------
2000/04/05          111

-------------------- -----------
20000405           112
 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50