mysql常用函数

1、字符串连接concat(str...)  --有null为null    应用字段合并

 2、mysql常见日期相关函数

来源:http://www.w3school.com.cn/sql/sql_dates.asp

 

a: Now()

获取当前时间(yyyy-MM-dd HH:mm:ss)

b:curdate()

获取当前日期

c:curTime()

获取当前时间

d:date(Now())

获取相关日期或者日期时间中的日期部分

e:date_add(Now(), interval exp type)

获取后天的这个时间

f:date_sub(Now(), interval exp type)

g:datediff(date1, date2)

获取两个日期直接相差的天数,结果为:date1 - date2  (可正可负)

h:extract()

返回日期时间的部分

i:date_format(date, format);

用不同的格式来显示日期时间

参考:http://www.w3school.com.cn/sql/func_date_format.asp

 

posted @ 2018-03-17 19:59  think的海角  阅读(159)  评论(4编辑  收藏  举报