Reading rows that fall within a particular date range

This example shows how to select only those rows from a MySQL database that fall where the created field (i.e. the date when the row was created) falls within a particular date range

Both techniques rely on the fact that UNIX-style timestamps store dates as integers. So it's possible to compare two dates by comparing the integers using easy math.

There are two ways to do this:

Here are the results of this query:

SELECT * FROM abloomberg_animals WHERE UNIX_TIMESTAMP(created) > 1337588587