for example:
db_query("SELECT DATE_FORMAT(from_unixtime(changed), '%Y-%m-%d') lastmod FROM node LIMIT 10");
This will return dates like 2011-09-0. The month day will always be zero. It will also match %s (seconds), %f (microseconds), and %b (abbreviated month name) Don't worry there's a simple solution.