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.
Tools:
- 1 ea mysql
1Make use of the DATE_SUB function
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.
Now learn about:
Discuss this guide
var disqus_shortname = ‘howchootest’; (function() { var dsq = document.createElement(‘script’); dsq.type = ‘text/javascript’; dsq.async = true; dsq.src = ‘//’ + disqus_shortname + ‘.disqus.com/embed.js’; (document.getElementsByTagName(‘head’)[0] || document.getElementsByTagName(‘body’)[0]).appendChild(dsq); })();
Tools:
- 1 ea mysql
Join Us
©2014 howchoo.com | About your privacy | Sitemap