How Drupal Stores Dates in MySQL

Tags:

Drupal stores dates in Unix time format. I had to look this up because I was trying to find email addresses for users who joined after a certain date. I used a SQL query in phpmyadmin and then exported into an OpenOffice spreadsheet:

SELECT `mail`, FROM_UNIXTIME(created) FROM `users` WHERE created > 1199145600 LIMIT 500;

That returns 500 emails from users who registered since January 1, 2008. The FROM_UNIXTIME(created) converts the Unix formatted time into something human-readable.

This Unix time converter is useful for turning a human-readable date into a Drupal date and vice versa.

See also this post.

Syndicate content