Time functions in SQL statements

For example, the time field in sql is
2018-12-14 10:13:26.
Insert picture description here
To get the year, month, and day of this time:
Get: Day
SELECT DAY (record_time) FROM sys_honorrecord
Insert picture description here
Get: Month
SELECT MONTH (record_time) FROM sys_honorrecord

Insert picture description here
Get: Year
SELECT YEAR (record_time) FROM sys_honorrecord
Insert picture description here

Published 67 original articles · Liked12 · Visitors 10,000+

Guess you like

Origin blog.csdn.net/m0_37635053/article/details/103865042