curdate time zone offset

How would I make this query subtract 3 hours to offset a time zone difference? Our server which holds the data is on EST but I want the data pulled from this query to be PST. Thank you.

$t_query = "SELECT SUM(Total) AS num FROM orders WHERE date_purchased > CURDATE()";
pkromerAsked:
Who is Participating?
 
todd_farmerConnect With a Mentor Commented:
Sorry about that:

$t_query = "SELECT SUM(Total) AS num FROM orders WHERE date_purchased > (CURDATE() - INTERVAL 3 HOUR)";

mysql> select curdate() - interval 3 hours;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'hours' at line 1

mysql> select curdate() - interval 3 hour;
+-----------------------------+
| curdate() - interval 3 hour |
+-----------------------------+
| 2006-11-26 21:00:00         |
+-----------------------------+
1 row in set (0.05 sec)
0
 
todd_farmerCommented:
$t_query = "SELECT SUM(Total) AS num FROM orders WHERE date_purchased > (CURDATE() - INTERVAL 3 HOURS)";
0
 
pkromerAuthor Commented:
I get an error when i test that...

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'HOURS)' at line 1
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
pkromerAuthor Commented:
btw, we are using PHP Version 4.3.10
0
 
pkromerAuthor Commented:
and MySQL Client API version  4.0.16  
0
 
pkromerAuthor Commented:
perfect. Thank you very much.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.