MySQL FROM_DAYS() Function

MySQL FROM_DAYS() function; In this tutorial, i am going to show you MySQL from_days function with the help of examples.

MySQL FROM_DAYS() Function

In MySQL, the FROM_DAYS() the function is used to returns a date value based on the number of days provided as a parameter or argument.

Syntax of MySQL FROM_DAYS() Function

The basic syntax of the FROM_DAY function is:

FROM_DAYS(N)

HereN is the number of days from day 0.

Example 1 – MySQL FROM_DAYS() Function

Let’s take an example using the MySQL FROM_DAYS() function(); as follows:

SELECT FROM_DAYS(367);

Output-1

+----------------+
| FROM_DAYS(367) |
+----------------+
| 0001-01-02     |
+----------------+

Note however that the MySQL documentation advises that this function is not for use with those values ​​that were before the arrival of the Gregorian calendar (1582).

Example 2 – MySQL FROM_DAYS() Function

Let’s take an example using the MySQL FROM_DAYS() function(); as follows:

SELECT FROM_DAYS(650000);

Output-2

+-------------------+
| FROM_DAYS(650000) |
+-------------------+
| 1779-08-22        |
+-------------------+

Example 3 – MySQL FROM_DAYS() Function

Let’s take another example with a later date again; as follows:

SELECT FROM_DAYS(750000);

Output-3

+-------------------+
| FROM_DAYS(750000) |
+-------------------+
| 2053-06-06        |
+-------------------+

Conclusion

MySQL FROM_DAYS() Function tutorial, you have learned how to use MySQL FROM_DAYS() function. You have also learned different FROM_DAYS () and TO_DAYS () function of MySQL.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *