Home >Backend Development >PHP Tutorial >使用convert函数转换。。。_PHP

使用convert函数转换。。。_PHP

WBOY
WBOYOriginal
2016-06-01 12:36:221046browse

在查询中加上convert转换。。。
convert(varchar(10),字段名,转换格式)

比如:
select user_id,convert(varchar(10),date,11) as date from tb_user

转换格式:
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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn