The EXTRACT() function extracts a part from a given date.
EXTRACT(
part FROM
date)
Parameter | Description |
---|---|
part | Required. The part to extract. Can be one of the following:
|
date | Required. The date to extract a part from |
Works in: | From MySQL 4.0 |
---|
Extract the minute from a datetime:
SELECT EXTRACT(MINUTE FROM "2017-06-15 09:34:21");
Try it Yourself »
Extract the year and month from a datetime:
SELECT EXTRACT(YEAR_MONTH FROM "2017-06-15 09:34:21");
Try it Yourself »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!