How to Query by Timestamp in MySQL

Tyler Tyler (291)
Total time: 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.

mysql×1

Howchoo is reader-supported. When you buy through links on our site, we may earn a small affiliate commission at no cost to you.

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.