Knowledge for the World

How to query by timestamp in mysql

This guide will simply cover how to find a data set by its timestamp including ranges. It will apply to mysql field that are of the "timestamp" type.

1

DATE_SUB subtracts a specified time interval from a date. You can use DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 HOUR) to grab data from the most recent hour.