I am trying to work out the hits per hour from a database. Data basically is stored as follows :
Table Name: Visitors
============================
VisitorIP TIMESTAMP
----------------------------
15.215.65.65 123456789
I want to display total hits per hour (within the last 6 hours ) including the hours that has no hits.
Example of the output:
// Assuming now : 21:00
21:00 - 0 hits
20:00 - 1 hits
19:00 - 4 hits
18:00 - 0 hits
17:00 - 2 hits
16:00 - 3 hits
i would love to get the data as array, Please note that the stored date is in UNIX time stamp format. and there may be some hours without any hits!
Thanks
You can use simple keyword BETWEEN for it. You can describe datetime is between values you want to select (range 3600 seconds).