MAKEDATE) : Date from year and day number in MySQL
Returns date by using day number ( in a year ) and year.
Output is 2016-02-03
Read more to know What is dayofyear
By using CURDATE() we get the present date part, by using YEAR() we will get YEAR. Here is a query with all these functions.
Output is 2021-10-25
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() are here
require 'config.php'; // Database connection string
$query='SELECT MAKEDATE(YEAR(CURDATE()),DAYOFYEAR(CURDATE()) )as dt';
// Change the above Query part to get different results //
$row = $count->fetch(PDO::FETCH_OBJ);
echo 'Output is : '.$row->dt;
This article is written by plus2net.com team.
▼ More on Date & Time functions in SQL