CURRENT_DATE/CURDATE

current_date()
  • 命令说明:返回当前日期
  • 返回值类型:DATE
  • 示例:
      select current_date()
      +--------------------+
      | _col0              |
      +--------------------+
      | 2018-12-27         |

CURRENT_TIME/CURTIME

 current_time()
  • 命令说明:返回当前时间
  • 返回值类型:TIME
  • 示例:
      select current_time()
      +--------------------+
      | _col0              |
      +--------------------+
      | 13:52:56           |

CURRENT_TIMESTAMP

 current_timestamp()
  • 命令说明:返回当前时间戳
  • 返回值类型:TIMESTAMP
  • 示例:
      select current_timestamp()
      +------------------------+
      | _col0                  |
      +------------------------+
      | 2018-12-27 13:54:42    |

CURRENT_TIMEZONE

 current_timezone()
  • 命令说明:返回当前时区
  • 返回值类型:VARCHAR
  • 示例:
      select current_timezone()
      +--------------------+
      | _col0              |
      +--------------------+
      | Asia/Shanghai      |

FROM_UNIXTIME

 from_unixtime()
  • 命令说明:返回unixtime时间戳
  • 返回值类型:TIMESTAMP
  • 示例:
      select from_unixtime(1522292553)
      +------------------------+
      | _col0                  |
      +------------------------+
      | 2018-03-29 11:02:33    |

LOCALTIME

 localtime()
  • 命令说明:返回本地时间
  • 返回值类型:TIME
  • 示例:
      select localtime()
      +--------------------+
      | _col0              |
      +--------------------+
      | 13:58:17           |

LOCALTIMESTAMP

 localtimestamp()
  • 命令说明:返回当前本地时间戳
  • 返回值类型:TIMESTAMP
  • 示例:
      select localtimestamp()
      +----------------------+
      | _col0                |
      +----------------------+
      | 2018-12-27 13:59:33  |

NOW

 now()
  • 命令说明:返回当前时间戳
  • 返回值类型:TIMESTAMP
  • 示例:
      select now()
      +------------------------+
      | _col0                  |
      +------------------------+
      | 2018-12-27 14:01:00    |

TO_UNIXTIME

to_unixtime(now())
  • 命令说明:转换为unix时间戳
  • 返回值类型:DOUBLE
  • 示例:
      select to_unixtime(now())
      +--------------------+
      | _col0              |
      +--------------------+
      | 1545890562         |

UTC_DATE

UTC_DATE(now())
  • 命令说明:返回utc日期
  • 返回值类型:VARCHAR
  • 示例:
      select UTC_DATE()
      +--------------------+
      | _col0              |
      +--------------------+
      | 2018-12-27         |

UTC_TIME

UTC_TIME()
  • 命令说明:返回utc时间
  • 返回值类型:VARCHAR
  • 示例:
      select UTC_TIME()
      +--------------------+
      | _col0              |
      +--------------------+
      | 06:12:71           |

UTC_TIMESTAMP

utc_timestamp()
  • 命令说明:返回utc时间戳
  • 返回值类型:VARCHAR
  • 示例:
      select utc_timestamp()
      +---------------------+
      | _col0               |
      +---------------------+
      | 2018-12-27 06:12:18 |