I spend over 8 hours last night to check all the documentations, browsing various post etc and I almost fixed my problem, yet there is stil something missing that I can't understand.
I have a table which stores various user submissions with a unix timestamp (e.g. 1351867293). I am extracting this information and counting it in order to get a total number for submissions "today", "yesterday", "this week" and so on.
The code I was using (for "today submissions") was:
WHERE DATE(from_unixtime(comment_date)) = CURRENT_DATE";
So far so good, but there was a time offset and the data wasn't displayed correctly. A user here on stackoverflow suggested to use CONVERT_TZ in order to get the offset fixed.
And here is the point where I am stuck. I am located in the CST timezone and my server seems to be located in the EST timezone. So I used this code
WHERE DATE(CONVERT_TZ(from_unixtime(comment_date), 'EST', 'CST')) = CURRENT_DATE";
...but it shows me only "0" as a result, though I have submissions for today. I tried different timezones but they all give me "0" as a result. When I replace EST and CST with numbers, for example:
WHERE DATE(CONVERT_TZ(from_unixtime(comment_date), '+00:00', '+07:00')) = CURRENT_DATE";
... I get a numeric output, but the number is not right. I tried a lot of combinations, including +08:00, -05:00, but nothing seems to work.
Basically what I am asking is what values to I have to place as those two numbers, in order to get correct results? Everything else on my website works and displays correctly in my timezone (CST), I am having only problems with this query.
The IP of my server is 50.116.13.130 if that helps.