MySQL query that creates the data for a heatmap that takes in timezone. This will form the data necessary to produce a map like the Trulia Trends graph.
Initially I wrote a query that did not account for timezones
SELECT WEEKDAY(date_created)+1 as weekday, HOUR(date_created)+1 as hour, SUM(sub_total) as value FROM transaction WHERE voided = 0 GROUP BY weekday, hour;
This works great, if all of our customers lived in the Greenwhich Royal Observatory and shared that timezone. But as soon as we move outside that timezone, things get more complicated.
The second solution I came up with was to set an offset. And it looked like the following