[MySQL]日付データから一部抽出

1587 ワード

YEAR

YEAR(기준 날짜)
SELECT YEAR(DATETIME) FROM ANIMAL_OUTS LIMIT 5;

MONTH

MONTH(기준 날짜)

SELECT MONTH(DATETIME) FROM ANIMAL_OUTS LIMIT 5;


DAY

DAY(기준 날짜)

SELECT DAY(DATETIME) FROM ANIMAL_OUTS LIMIT 5;


HOUR

HOUR(기준 날짜)

SELECT HOUR(DATETIME) FROM ANIMAL_OUTS LIMIT 5;


MINUTE

MINUTE(기준 날짜)

SELECT MINUTE(DATETIME) FROM ANIMAL_OUTS LIMIT 5;

---

SECOND

SECOND(기준 날짜)

SELECT SECOND(DATETIME) FROM ANIMAL_OUTS LIMIT 5;