Collections:
MAKEDATE() - Making Date from Days
How to calculate the date from year and day-of-year using the MAKEDATE() function?
✍: FYIcenter.com
MAKEDATE(year, days) is a MySQL built-in function that
calculates the date from year and day-of-year.
For example:
SELECT MAKEDATE(2021,31), MAKEDATE(2021,32); -- +-------------------+-------------------+ -- | MAKEDATE(2021,31) | MAKEDATE(2021,32) | -- +-------------------+-------------------+ -- | 2021-01-31 | 2021-02-01 | -- +-------------------+-------------------+ SELECT MAKEDATE(2023,366), MAKEDATE(2024,366); -- +--------------------+--------------------+ -- | MAKEDATE(2023,366) | MAKEDATE(2024,366) | -- +--------------------+--------------------+ -- | 2024-01-01 | 2024-12-31 | -- +--------------------+--------------------+
Reference information of the MAKEDATE() function:
MAKEDATE(year, days): dt Returns a date, given year and day-of-year values. dayofyear must be greater than 0 or the result is NULL. Arguments, return value and availability: year: Required. The year to calculate the date from. days: Required. The number of days to be added to the year. dt: Return value. The calculated date. Available since MySQL 4.
⇒ MAKETIME() - Making Time from Components
⇐ LOCALTIMESTAMP() - Synonym for NOW()
2023-11-17, 1108🔥, 0💬
Popular Posts:
How To Get a List of All Tables with "sys.tables" View in SQL Server? If you want to see the table y...
How To Fix the INSERT Command Denied Error in MySQL? The reason for getting the "1142: INSERT comman...
How To Assign Debug Privileges to a User in Oracle? In order to run SQL Developer in debug mode, the...
How To Set Up SQL*Plus Output Format in Oracle? If you want to practice SQL statements with SQL*Plus...
How to continue to the next iteration of a WHILE loop in SQL Server Transact-SQL? How to use CONTINU...