mysql - How to model a database to handle counters on multiple timezones -
I have a table that has analytical information, that is: Page view on each page.
Field type --------------------------- Page_ id Long time created time (era (UTC - rotating hours) Page_view tall I give the era down to hour (example: 1398456553 ==> 1398456000), which gives this table the information collected per hour.
When a customer requests his data, we allow the appropriate adjustments to view the data in his local timezone.
If the client's local timezone is UTC, then the query is simple:
SELECT FROM_UNIXTIME (St. Curated_time ','% Y-% m-% d ') From page_views as Created_at, SUM (St. Page_views`) `St. Curated_time 'between 13 96310400 - 01 April 2014 00:00:00 GMT and 1397088000 - April 10, 2014 00:00:00 GMT created by Group; If the client's timezone is elsewhere (Example: -03: 00), then the query needs a little more manipulation to adjust the dates to correct tees:
Comments
Post a Comment