分析语句 函数 作用 定义 示例 curdate 当前日期 curdate() > date SELECT curdate() LIMIT 1 date 日期 date(date) > date SELECT date() LIMIT 1 dateformat 根据格式获取对应日期值 dateformat(date, string) > string SELECT dateformat(date, 'Y') LIMIT 1 dayofmonth 月份 dayofmonth(date) > integer SELECT dayofmonth(date) LIMIT 1 dayofweek 周几 dayofweek(date) > integer SELECT dayofweek(date) LIMIT 1 dayofyear 当年天数 dayofyear(date) > integer SELECT dayofyear(date) LIMIT 1 hourofday 当天小时数 hourofday(date) > integer SELECT hourofday(date) LIMIT 1 maketime 生成日期 maketime(integer, integer, integer) > time SELECT maketime(11, 30, 00) LIMIT 1 minuteofhour 当前小时分钟数 minuteofhour(date) > integer SELECT minuteofhour(date) LIMIT 1 minuteofday 当天分钟数 minuteofday(date) > integer SELECT minuteofday(date) LIMIT 1 monthname 月份名称 monthname(date) > string SELECT monthname(date) LIMIT 1 now 当前时间 now() > time SELECT now() LIMIT 1 secondofminute 秒数 minuteofday(date) > integer SELECT minuteofday(date) LIMIT 1 timestamp 日期 timestamp(date) > date SELECT timestamp(date) LIMIT 1 year 年份 year(date) > integer SELECT year(date) LIMIT 1