数据库的日期格式转换

2018-09-07 14:50

阅读:308

  只要在convert中指定日期格式的代号就够了,如:

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


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

日期格式代号
-------------------- -----------
04/05/2000101

-------------------- -----------
2000.04.05102

-------------------- -----------
05/04/2000103

-------------------- -----------
05.04.2000104

-------------------- -----------
05-04-2000105

-------------------- -----------
05 Apr 2000106

-------------------- -----------
Apr 05, 2000107

-------------------- -----------
11:33:24108

-------------------- -----------
Apr 5 2000 11:33:24109

-------------------- -----------
04-05-2000110

-------------------- -----------
2000/04/05111

-------------------- -----------
20000405112


评论


亲,登录后才可以留言!