zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

数据库的日期格式转换

2023-06-13 09:13:44 时间
只要在convert中指定日期格式的代号就够了,如:

selectconvert(char(20),getdate(),101)
selectemp_id,convert(char(20),hire_dt,101)fromemployee


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

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

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

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

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

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

-------------------------------
05Apr2000         106

-------------------------------
Apr05,2000         107

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

-------------------------------
Apr5200011:33:24     109

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

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

-------------------------------
20000405           112