打印

[PHP教程] 数据库的日期格式转换

数据库的日期格式转换

只要在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


TOP

返回顶部
AYBlue

Processed in 0.057831 second(s), 7 queries.

当前时区 GMT+8, 现在时间是 2009-1-8 11:09 京ICP备06054220号

清除 Cookies - 联系我们 - 163K.com - Archiver - WAP