How to query by timestamp in mysql

  • by Murphy (1)
  • Time to complete: 1 minute

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.