首页  >  文章  >  后端开发  >  数据库的日期格式转换_PHP教程

数据库的日期格式转换_PHP教程

WBOY
WBOY原创
2016-07-21 16:04:10847浏览

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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/316015.htmlTechArticle只要在convert中指定日期格式的代号就够了,如: select convert(char(20),getdate(),101) select emp_id,convert(char(20),hire_dt,101) from employee -----------------------...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn