MySQL FROM_DAYS() function
FROM_DAYS() function
MySQL FROM_DAYS() returns a date against a datevalue. It takes the number of days since year 0 as an argument and returns the corresponding date.
This function is useful in -
- FROM_DAYS() is useful for historical or archaeological data that uses a day count since year 0 to represent dates.
- FROM_DAYS() is helpful when dealing with date representations that are based on a numeric day count rather than the standard year-month-day format.
- The function can be used to adjust dates by a specific number of days, allowing you to calculate new dates relative to a given day count.
- FROM_DAYS() can be used to convert day counts from external sources into valid date values in MySQL.
- For systems that use Julian day counts, FROM_DAYS() can be used to convert these counts into MySQL-compatible dates.
- FROM_DAYS() is valuable when working with historical documents or records that use a day-count-based date representation.
Syntax:
FROM_DAYS(N)
Where N is a datevalue.
Syntax Diagram:
MySQL Version: 8.0
Pictorial Presentation:
Example: MySQL FROM_DAYS() function
The following statement will return a date against the datevalue 733910.
Code:
SELECT FROM_DAYS(733910);
Output:
mysql> SELECT FROM_DAYS(733910); +-------------------+ | FROM_DAYS(733910) | +-------------------+ | 2009-05-18 | +-------------------+ 1 row in set (0.00 sec)
Video Presentation:
All Date and Time Functions:
Click here to see the MySQL Date and time functions.
Previous: EXTRACT()
Next: FROM_UNIXTIME()
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/mysql/date-and-time-functions/mysql-from_days-function.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics