數(shù)據(jù)庫(kù)的日期格式轉(zhuǎn)換
更新時(shí)間:2006年10月09日 00:00:00 作者:
只要在convert中指定日期格式的代號(hào)就夠了,如:
select convert(char(20),getdate(),101)
select emp_id,convert(char(20),hire_dt,101) from employee
-----------------------------------------------------
日期格式 代號(hào)
-------------------- -----------
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
select convert(char(20),getdate(),101)
select emp_id,convert(char(20),hire_dt,101) from employee
-----------------------------------------------------
日期格式 代號(hào)
-------------------- -----------
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
相關(guān)文章
使用數(shù)據(jù)庫(kù)保存session的方法
使用數(shù)據(jù)庫(kù)保存session的方法...2006-10-10在PHP3中實(shí)現(xiàn)SESSION的功能(三)
在PHP3中實(shí)現(xiàn)SESSION的功能(三)...2006-10-10