convert(varchar(10),字段名,转换格式)
比如:
1.select user_id,convert(varchar(10),dayts,11) as dates from tb_user (sybase下及sql server下语句)
2.select to_char(sysdate,'yy/mm/dd') as d from dual (oracle下语句)
转换格式:
0或100 month dd yyyy hh:miampm
1 mm/dd/yy
2 yy.mm.dd
3 dd/mm/yy
4 dd.mm.yy
5 dd-mm-yy
6 dd month yy
7 month dd,yy
8 hh:mi:ss
9或109 month dd yyyy hh:mi:ss:mmmampm
10 mm-dd-yy
11 yy/mm/dd
12 yymmdd
101 mm/dd/yyyy
102 yyyy.mm.dd
103 dd/mm/yyyy
104 dd.mm.yyyy
105 dd-mm-yyyy
106 dd month yyyy
107 month dd,yyyy
108 hh:mi:ss
110 mm-dd-yyyy
111 yyyy/mm/dd
112 yyyymmdd