mariadbHow to get current year in Mariadb?
The current year can be obtained in Mariadb using the YEAR()
function.
Example code
SELECT YEAR(NOW());
Output example
2020
The YEAR()
function takes a date as an argument and returns the year of that date. In the example above, the NOW()
function is used to get the current date and time, and the YEAR()
function is used to get the current year.
Code explanation
YEAR()
: Function to get the year of a given dateNOW()
: Function to get the current date and time
Helpful links
More of Mariadb
- How to use window functions in Mariadb?
- How to check version of Mariadb?
- How to use UUID in Mariadb?
- What type to use for a year in Mariadb?
- How to use variables in Mariadb?
- How to list users in Mariadb?
- How to use xtrabackup in Mariadb?
- Mariadb partitioning example
- Mariadb procedure example
- Mariadb fulltext search example
See more codes...