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
- What type to use for a year in Mariadb?
- How to check version of Mariadb?
- How to list users in Mariadb?
- How to use UUID in Mariadb?
- Mariadb partitioning example
- How to work with XML in Mariadb?
- How to use variables in Mariadb?
- Mariadb procedure example
- How to change wait_timeout in Mariadb?
See more codes...