views:

48

answers:

1

Hi everyone,

I am trying to select entries for a current date but cannot seem to get past the issue of a 1 hour time difference between my timezone and that of the server.

I was able to overcome this by using DATE_ADD() for adding entries but now I need to do the same to SELECT them. I tried inserting SET time_zone = 'America/New_York'into my MySQL connection command but it did not appear to change anything. I am using a PDO::QUERY statement, here is my connection command:

$db = new PDO('mysql:host=localhost;dbname=nightdes_points', $dbuser, $dbpsw);

What am I missing here? Thanks!

+2  A: 

I would always store data in GMT0 and on insert/update/select I would always pass (converted) GMT0 date.

thelost
Is there maybe a way to do this without conversion? This app is for use by only one person and I came across this problem pretty late. The set time_zone looked promising, am I just not using it properly?
NightMICU
This would be error-prone as the user could change the OS timezone anytime.
thelost
I understand that in the grand scheme setting the timezone may not be the best option, but this site will only be used by one person on the east coast. With that in mind, how would I make that change?
NightMICU