;

How to Get the Name of the Day of the Week from a Date in MySQL


Tutorialsrack 26/01/2020 MySQL

In this article, we will learn how to get the name of the day of the week from a date in MySQL.

In MySQL, DAYNAME() function returns the full name of the day of the week for a specified date. 

DAYNAME() function returns a value from Sunday to Saturday as an output.

Here are some examples of DAYNAME() Function in MySQL.

Various Example of DAYNAME() Function
SELECT DAYNAME(now()) AS 'Name of the Day of The Week';
-- This will return the Name of the Day of The Week as -> Name of the Day of The Week whatever it is

SELECT DAYNAME('2020-08-01')  AS 'Name of the Day of The Week';
-- This will returns the Name of the Day of The Week as -> Saturday

SELECT DAYNAME('2020-00-00')  AS 'Name of the Day of The Week';
-- This will returns the Name of the Day of The Week as -> NULL

SELECT DAYNAME('2020/1/1')  AS 'Name of the Day of The Week';
-- This will returns the Name of the Day of The Week as -> Wednesday

SELECT DAYNAME('2020-01-02 12:20:30')  AS 'Name of the Day of The Week';
-- This will returns the Name of the Day of The Week as -> Thursday

SELECT DAYNAME('2020-01-02 0:0:1')  AS 'Name of the Day of The Week';
-- This will returns the Name of the Day of The Week as -> Thursday

I hope this article will help you to understand how to get the name of the day of the week from a date in MySQL.

Share your valuable feedback, please post your comment at the bottom of this article. Thank you!


Related Posts



Comments

Recent Posts
Tags