ByteNoise

MySQL tips

Date and time

How to work out the weeks difference between two dates

SELECT FLOOR((TO_DAYS('2009-04-01') - TO_DAYS('2009-01-01')) / 7);

These are simply tricks I've learnt during my years as a web developer. They may not be the best solutions. Please e-mail me any bugfixes or improvements to these examples. Thank you.