日期时间函数

分布式数据库 GaiaDB-X DRDS

  • 术语表
  • 产品定价
  • 产品描述
    • 介绍
    • 优势
    • 基本原理
    • 应用场景
    • 特性
    • 功能发布记录
  • 开发指南
    • 运算符
    • 开发限制
    • 函数
      • 聚合函数
      • 字符串函数
      • 加密与压缩函数
      • 流程控制函数
      • 数学函数
      • 信息函数
      • 转换函数
      • 日期时间函数
      • 比较函数
      • 位函数
    • DDL语句
      • AUTO_INCREMENT
      • DROP TABLE
      • CREATE TABLE
      • RENAME TABLE
      • CREATE DATABASE
      • DROP DATABASE
    • 数据类型
      • 数值类型
      • 字符串类型
      • JSON类型
      • 日期和时间类型
      • Collation类型
    • DML语句
      • INSERT
      • SOURCE
      • REPLACE
      • DELETE
      • UPDATE
  • 重要通知
    • 品牌升级
  • 快速入门
    • 首次使用引导
    • 创建数据库
    • 执行SQL基本操作
    • 创建实例
  • 服务等级协议SLA
    • GaiaDB-X服务等级协议SLA
  • API参考
    • 通用说明
    • 其他接口
    • SampleCode
    • 实例管理接口说明
    • 账号管理接口说明
    • 目录
    • 白名单管理接口说明
    • 数据库管理接口说明
    • 数据表管理接口说明
  • 常见问题
    • 配置类问题
  • 用户指南
    • 备份与恢复
    • 参数设置
    • 登录、创建实例
    • 监控报警
    • 连接云数据库-DRDS-实例
    • 操作指引
    • 连接数据库
    • 节点详情
      • 代理节点
      • 存储节点
        • 存储节点变更配置
        • 存储节点
      • 只读节点
        • 只读节点
        • 释放只读节点
        • 添加只读节点
    • 实例管理
      • 修改实例名称、域名
      • 实例变配
      • 高级设置
      • 增加和减少节点
      • 释放实例
    • 数据库管理
      • 删除数据库
      • 使用限制
      • 创建数据库
      • 管理数据库
    • 账号和安全
      • 修改账号密码
      • 修改权限
      • 管理数据库账号
      • 删除账号
      • 设置白名单
所有文档
menu
没有找到结果,请重新输入

分布式数据库 GaiaDB-X DRDS

  • 术语表
  • 产品定价
  • 产品描述
    • 介绍
    • 优势
    • 基本原理
    • 应用场景
    • 特性
    • 功能发布记录
  • 开发指南
    • 运算符
    • 开发限制
    • 函数
      • 聚合函数
      • 字符串函数
      • 加密与压缩函数
      • 流程控制函数
      • 数学函数
      • 信息函数
      • 转换函数
      • 日期时间函数
      • 比较函数
      • 位函数
    • DDL语句
      • AUTO_INCREMENT
      • DROP TABLE
      • CREATE TABLE
      • RENAME TABLE
      • CREATE DATABASE
      • DROP DATABASE
    • 数据类型
      • 数值类型
      • 字符串类型
      • JSON类型
      • 日期和时间类型
      • Collation类型
    • DML语句
      • INSERT
      • SOURCE
      • REPLACE
      • DELETE
      • UPDATE
  • 重要通知
    • 品牌升级
  • 快速入门
    • 首次使用引导
    • 创建数据库
    • 执行SQL基本操作
    • 创建实例
  • 服务等级协议SLA
    • GaiaDB-X服务等级协议SLA
  • API参考
    • 通用说明
    • 其他接口
    • SampleCode
    • 实例管理接口说明
    • 账号管理接口说明
    • 目录
    • 白名单管理接口说明
    • 数据库管理接口说明
    • 数据表管理接口说明
  • 常见问题
    • 配置类问题
  • 用户指南
    • 备份与恢复
    • 参数设置
    • 登录、创建实例
    • 监控报警
    • 连接云数据库-DRDS-实例
    • 操作指引
    • 连接数据库
    • 节点详情
      • 代理节点
      • 存储节点
        • 存储节点变更配置
        • 存储节点
      • 只读节点
        • 只读节点
        • 释放只读节点
        • 添加只读节点
    • 实例管理
      • 修改实例名称、域名
      • 实例变配
      • 高级设置
      • 增加和减少节点
      • 释放实例
    • 数据库管理
      • 删除数据库
      • 使用限制
      • 创建数据库
      • 管理数据库
    • 账号和安全
      • 修改账号密码
      • 修改权限
      • 管理数据库账号
      • 删除账号
      • 设置白名单
  • 文档中心
  • arrow
  • 分布式数据库 GaiaDB-XDRDS
  • arrow
  • 开发指南
  • arrow
  • 函数
  • arrow
  • 日期时间函数

日期时间函数

更新时间:2025-08-21

本文介绍了 GaiaDB-X 支持的日期时间函数。

函数名 描述
ADDDATE() Add time values (intervals) to a date value
ADDTIME() Add time
CURDATE() Return the current date
CURRENT_DATE(), CURRENT_DATE Synonyms for CURDATE()
CURRENT_TIME(), CURRENT_TIME Synonyms for CURTIME()
CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP Synonyms for NOW()
CURTIME() Return the current time
DATE() Extract the date part of a date or datetime expression
DATE_ADD() Add time values (intervals) to a date value
DATE_FORMAT() Format date as specified
DATE_SUB() Subtract a time value (interval) from a date
DATEDIFF() Subtract two dates
DAY() Synonym for DAYOFMONTH()
DAYNAME() Return the name of the weekday
DAYOFMONTH() Return the day of the month (0-31)
DAYOFWEEK() Return the weekday index of the argument
DAYOFYEAR() Return the day of the year (1-366)
EXTRACT() Extract part of a date
FROM_DAYS() Convert a day number to a date
FROM_UNIXTIME() Format Unix timestamp as a date
HOUR() Extract the hour
LAST_DAY Return the last day of the month for the argument
MAKEDATE() Create a date from the year and day of year
MAKETIME() Create time from hour, minute, second
MICROSECOND() Return the microseconds from argument
MINUTE() Return the minute from the argument
MONTH() Return the month from the date passed
MONTHNAME() Return the name of the month
NOW() Return the current date and time
PERIOD_ADD() Add a period to a year-month
PERIOD_DIFF() Return the number of months between periods
QUARTER() Return the quarter from a date argument
SEC_TO_TIME() Converts seconds to 'hh:mm:ss' format
SECOND() Return the second (0-59)
STR_TO_DATE() Convert a string to a date
SUBDATE() Synonym for DATE_SUB() when invoked with three arguments
SUBTIME() Subtract times
SYSDATE() Return the time at which the function executes
TIME() Extract the time portion of the expression passed
TIME_FORMAT() Format as time
TIME_TO_SEC() Return the argument converted to seconds
TIMEDIFF() Subtract time
TIMESTAMP() With a single argument, this function returns the date or datetime expression; with two arguments, the sum of the arguments
TIMESTAMPADD() Add an interval to a datetime expression
TIMESTAMPDIFF() Subtract an interval from a datetime expression
TO_DAYS() Return the date argument converted to days
TO_SECONDS() Return the date or datetime argument converted to seconds since Year 0
UNIX_TIMESTAMP() Return a Unix timestamp
UTC_DATE() Return the current UTC date
UTC_TIME() Return the current UTC time
UTC_TIMESTAMP() Return the current UTC date and time
WEEK() Return the week number
WEEKDAY() Return the weekday index
WEEKOFYEAR() Return the calendar week of the date (1-53)
YEAR() Return the year
YEARWEEK() Return the year and week

相比MySQL 5.7,GaiaDB-X暂不支持的函数,如下:

函数名 描述
CONVERT_TZ() Convert from one time zone to another
GET_FORMAT() Return a date format string
LOCALTIME(), LOCALTIME Synonym for NOW()
LOCALTIMESTAMP, LOCALTIMESTAMP() Synonym for NOW()

上一篇
转换函数
下一篇
比较函数