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

How to use mysql date function TO_DAYS() function

WBOY
WBOYforward
2023-05-27 11:34:141989browse

TO_DAYS() function

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

select TO_DAYS(now()) as days

How to use mysql date function TO_DAYS() function

select TO_DAYS(now()) as days

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

. 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!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete