1、字符函数
1.1、大小写控制函数
- lower(‘ABC’) => abc
- upper(‘abc’) => ABC
1.2、字符控制函数
- concat(连接):concat(‘hello’ , ‘world’) => helloworld
- substr(截取):substr(‘helloworld’ , 1 , 5)=> hello
- length(计算长度):length(‘helloworld’) => 10
- instr(找到元素所在位置:从1开始):instr(‘helloworld’ , ‘w’)=> 6
- trim(剔除):trim(‘h’ from ‘helloworld’) => elloworld
- replace(替换):replace(‘abcd’ , ‘b’ , ‘m’)=> amcd
2、数字函数
- round(四舍五入):round(45.926 ,2) => 45.93
- truncate(截段):truncate(45.926 ,2)=> 45.92
- mod(求余):mod(4600 ,300)=> 100
3、日期函数
- now :获取当前日期
- date_format(将日期格式转化为字符) :date_format(‘2018/6/6’ , ‘%Y年%m月%d日’)=> 2018年06月06日
- str_to_date(将日期转化为指定格式):str_to_date(‘9-13-1999’ ,‘%m-%d=%Y’)=> 1999–09-13
- 格式符