Collections:
FROM_DAYS() - Converting Days to Date
How to calculate the date from days using the FROM_DAYS() function?
✍: FYIcenter.com
FROM_DAYS(N) is a MySQL built-in function that
returns the date from a given day number.
For example:
SELECT FROM_DAYS(365), FROM_DAYS(366); -- +----------------+----------------+ -- | FROM_DAYS(365) | FROM_DAYS(366) | -- +----------------+----------------+ -- | 0000-00-00 | 0001-01-01 | -- +----------------+----------------+ SELECT FROM_DAYS(1000), FROM_DAYS(10000), FROM_DAYS(100000); -- +-----------------+------------------+-------------------+ -- | FROM_DAYS(1000) | FROM_DAYS(10000) | FROM_DAYS(100000) | -- +-----------------+------------------+-------------------+ -- | 0002-09-27 | 0027-05-19 | 0273-10-16 | -- +-----------------+------------------+-------------------+ SELECT FROM_DAYS(700000), FROM_DAYS(739000), FROM_DAYS(1000000); -- +-------------------+-------------------+--------------------+ -- | FROM_DAYS(700000) | FROM_DAYS(739000) | FROM_DAYS(1000000) | -- +-------------------+-------------------+--------------------+ -- | 1916-07-15 | 2023-04-25 | 2737-11-28 | -- +-------------------+-------------------+--------------------+
Reference information of the FROM_DAYS() function:
FROM_DAYS(N): date Returns the date value from a given day number N. It is not intended for use with values that precede the advent of the Gregorian calendar. Arguments, return value and availability: N: Required. The day number starts from the day of 0000-00-00. date: Required. The date calculated from day number N. int: Return value. Extracted components concatenated as an integer. Available since MySQL 4.
⇒ FROM_UNIXTIME() - Unix Time to Datetime
⇐ FORMAT_PICO_TIME() - Formatting Picoseconds in Readable Units
2023-11-17, 897🔥, 0💬
Popular Posts:
How To Calculate DATETIME Value Differences Using the DATEDIFF() Function in SQL Server Transact-SQL...
What is SQL Server Transact-SQL (T-SQL)? SQL Server Transact-SQL, also called T-SQL, is an extension...
Where to find answers to frequently asked questions on CREATE, ALTER and DROP Statements in MySQL? H...
How To Count Rows with the COUNT(*) Function in SQL Server? If you want to count the number of rows,...
What is SQL Server Transact-SQL (T-SQL)? SQL Server Transact-SQL, also called T-SQL, is an extension...