get individual date elements in mysql

Solutions on MaxInterview for get individual date elements in mysql by the best coders in the world

showing results for - "get individual date elements in mysql"
Sara
07 Jan 2017
1-- To get the year of a date in mysql
2SELECT YEAR(NOW());
3
4-- To get the month of a date in mysql
5SELECT MONTH(NOW());
6
7-- To get the day of a date in mysql
8SELECT DAY(NOW());
9
10-- To get the hour of a date in mysql
11SELECT HOUR(NOW());
12
13-- To get the minute of a date in mysql
14SELECT MINUTE(NOW());
15
16-- To get the second of a date in mysql
17SELECT SECOND(NOW());