Drupal dates format in unix time

Converting Drupal dates from timestamp to MySql dates

Drupal stores dates in Unix time or timestamp format, so here is the code to show it in MySql format:


FROM `users`


The function FROM_UNIXTIME, will convert the format for you, here is a simple query sample to get a list of users created today:


SELECT `mail`, FROM_UNIXTIME(created) FROM `users` 
WHERE FROM_UNIXTIME(created,'%d-%m-%Y') = '21-01-2011'


Well, you can change the date, of course!