Calcolo della differenza tra due date in giorni: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 3: | Line 3: | ||
== | == Calcolare la differenza in giorni tra due date in MySQL == | ||
Heres a handy reference that uses MySQL to find the number of days between two dates. | Heres a handy reference that uses MySQL to find the number of days between two dates. | ||
| Line 20: | Line 20: | ||
The dates I used are just examples. Obviously, you can insert any dates in there, as long as the most recent date is listed first. | The dates I used are just examples. Obviously, you can insert any dates in there, as long as the most recent date is listed first. | ||
== Link Utili == | |||
[http://dev.mysql.com/doc/mysql/en/date-calculations.html MySQL Reference Manual :: 3.3.4.5 Date Calculations] | |||
Latest revision as of 18:25, 16 August 2005
Preso da Date difference in MySQL
Calcolare la differenza in giorni tra due date in MySQL
Heres a handy reference that uses MySQL to find the number of days between two dates.
From the MySQL standpoint, this is obviously a popular thing to do, because as of version 4.1.1, there are explicit functions that do just that. But, as of this date, version 4.1.1 is not the release build, so I will mention another way to do it.
Prior to MySQL 4.1.1:
SELECT TO_DAYS('2004-11-08') - TO_DAYS('2004-07-26');
> 105
As of MySQL 4.1.1:
SELECT DATEDIFF('2004-11-08','2004-07-26');
> 105
The dates I used are just examples. Obviously, you can insert any dates in there, as long as the most recent date is listed first.