Mega Code Archive

 
Categories / MySQL / Date Time
 

For an interval in weeks, do the same thing and divide the result by seven

mysql> mysql> SELECT (TO_DAYS('1884-01-01') - TO_DAYS('1883-06-05')) / 7 AS weeks; +---------+ | weeks   | +---------+ | 30.0000 | +---------+ 1 row in set (0.00 sec) mysql>