Home > Database > Mysql Tutorial > How to use mysql date function TO_DAYS() function

How to use mysql date function TO_DAYS() function

WBOY
Release: 2023-05-27 11:34:14
forward
1957 people have browsed it

TO_DAYS() function

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

select TO_DAYS(now()) as days
Copy after login
Copy after login

How to use mysql date function TO_DAYS() function

select TO_DAYS(now()) as days
Copy after login
Copy after login

As you can see, from From AD 0 to November 29, 2021, there are a total of 739,488 days. Remember this number

How to use mysql date function TO_DAYS() function

select TO_DAYS('21-11-29') as days
Copy after login

. You can see that the number of days is the same, and the year is only written after Two digits will be automatically converted to 4 digits

How to use mysql date function TO_DAYS() function

The rules in MySQL "Date and Time Type" convert the two-digit year value in the date to four digits

For dates before 1582 (or perhaps the next year in other regions), the results of this function are unreliable

The above is the detailed content of How to use mysql date function TO_DAYS() function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template