Find the last monday before a date in MySQL
Posted by James | Posted in Public | Posted on 16-11-2010
Tags: mysql
0
DATE_SUB(O.ScheduledDate, INTERVAL WEEKDAY(O.ScheduledDate) DAY) AS LastMonday
Not only can this be used to test XML but it can also be used to test HTML output from things like render methods and such. Using cURL you could even use some of these techniques to automatically test output on remote sites. All kinds of fun stuff. http://qafoo.com/blog/007_practical_phpunit_testing_xml_generation.html
DATE_SUB(O.ScheduledDate, INTERVAL WEEKDAY(O.ScheduledDate) DAY) AS LastMonday