Skip to content

日期部分

DATE_PART(unit, timestamp_val)

等价于 EXTRACT(unit FROM timestamp_val) 具有以下单位字符串字面量:

  • 年份: year, years, yr, yrs, y, yy, yyy, yyyy
  • 季度: quarter, quarters, q, qtr, qtrs
  • 月份: month, months, mm, mon, mons
  • 周: week, weeks, weekofyear, w, wk, woy, wy
  • 天: day, days, dayofmonth, d, dd
  • 小时: hour, hours, hrs, h, hr, hrs
  • 分钟: minute, minutes, m, mi, min, mins
  • 秒: second, seconds, s, sec, secs
  • 毫秒: millisecond, milliseconds, ms, msecs
  • 微秒: microsecond, microseconds, us, usec
  • NANOSECOND: nanosecondnanosecondsnanosecnsecnsecsnsecondnsnanonsecs
  • TZH
  • TZM

支持带时区的数据。注意,TZH/TZM 仅支持 TIMESTAMP_TZ 输入,并提取偏移小时和偏移分钟。