If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
YEAR()
function एक date as an argument लेता है और date की year value return करता है।
YEAR(date_value);
YEAR() function 1000 से 9999 की range में year value return करता है , अगर date है 0 तो आपको 0 ही मिलेगा।
SELECT YEAR('2023-03-02');
Output
+--------------------+ | YEAR('2023-03-02') | +--------------------+ | 2023 | +--------------------+
ध्यान रहे अगर date value NULL
pass होगी तो return में भी NULL ही मिलेगा।
SELECT YEAR(NULL);
Output
+------------+ | YEAR(NULL) | +------------+ | NULL | +------------+
Current year , get करने के लिए NOW() function को directly pass कर सकते हैं।
For Example
SELECT YEAR(NOW());
Output
+-------------+ | YEAR(NOW()) | +-------------+ | 2023 | +-------------+
जैसा कि अपने ऊपर पढ़ा कि अगर value में 0 या '0000-00-00' pass किया तो 0 ही मिलेगा।
Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)
Get connected with me. :) LinkedIn Twitter Instagram Facebook