MySQL EXTRACT() Function

Clash Royale CLAN TAG#URR8PPP
<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]-->
MySQL EXTRACT() Function
❮ MySQL Functions
Example
Extract the month from a date:
SELECT EXTRACT(MONTH FROM "2017-06-15");Try it Yourself »
Definition and Usage
The EXTRACT() function extracts a part from a given date.
Syntax
EXTRACT(part FROM date)Parameter Values
| Parameter | Description |
|---|---|
| part | Required. The part to extract. Can be one of the following:
|
| date | Required. The date to extract a part from |
Technical Details
| Works in: | From MySQL 4.0 |
|---|
More Examples
Example
Extract the week from a date:
SELECT EXTRACT(WEEK FROM "2017-06-15");Try it Yourself »
Example
Extract the minute from a datetime:
SELECT EXTRACT(MINUTE FROM "2017-06-15 09:34:21");Try it Yourself »
Example
Extract the year and month from a datetime:
SELECT EXTRACT(YEAR_MONTH FROM "2017-06-15 09:34:21");Try it Yourself »
❮ MySQL Functions