MySQL to_days ()

Source: Internet
Author: User
MySQL to_days (date) function to_days ( date)

Given a date , returns a number of days, starting from year 0.

Mysql> SELECT to_days (950501);

728779

Mysql> SELECT to_days (' 1997-10-07′);

729669

To_days () is not used for values before the Gregorian calendar (1582), because the lost date is not taken into account when the calendars are changed.

Keep in mind that the rules in MySQL date and time type convert the two-digit year value in a date to four-bit. For example, ' 1997-10-07′ and ' 97-10-07′ are considered the same date:

Mysql> SELECT to_days (' 1997-10-07′), To_days (' 97-10-07′);

--729669, 729669

The result of this function is unreliable for dates prior to 1582 (perhaps in other regions for the next year).

MySQL to_days ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.