DAYNAME() : weekday name in Full from input Date in MySQL

SELECT DAYNAME('2016-08-24') 
Output is Wednesday

Syntax
DAYNAME()
Example :
DEMO: Select date from Calendar to execute DAYNAME()

DAYNAME() function to get full name of the weekday in MySQL


CURDATE() or NOW() & DAYNAME()

By using CURDATE() we get the present date part only, where as by using NOW() we will get both date and time.
SELECT DAYNAME(CURDATE())
Output is Tuesday
SELECT DAYNAME(NOW())
Output is Tuesday

Yesterday , Today and Tomorrow

SELECT DAYNAME(CURDATE()- interval 1 day)  as YesterDay, 
DAYNAME(CURDATE()) as Today, 
DAYNAME(CURDATE()+ interval 1 Day) as Tomorrow
YesterDayTodayTomorrow
MondayTuesdayWednesday

PHP Script

To display the above details we used PHP Script, you can use the same script for using all above queries.
config.php connection string is available here
PDO for executing Queries in PHP
How to get records using FETCH() is here
<?Php
require 'config.php';  // Database connection string
$query='SELECT DAYNAME(CURDATE()) as dt';
// Change the above Query part to get different results // 

$count=$dbo->prepare($query);
$count->execute();
$row = $count->fetch(PDO::FETCH_OBJ);
echo 'Output is : '.$row->dt; 
?>
SQL Date MONTHNAME() : Month name in Full ( November )
SQL txt file for DAYNAME()
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com

    Post your comments , suggestion , error , requirements etc here





    SQL Video Tutorials










    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer