Solved

curdate time zone offset

Posted on 2006-11-27
6
1,692 Views
Last Modified: 2012-06-21
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()";
0
Comment
Question by:pkromer
  • 4
  • 2
6 Comments
 
LVL 30

Expert Comment

by:todd_farmer
ID: 18021824
$t_query = "SELECT SUM(Total) AS num FROM orders WHERE date_purchased > (CURDATE() - INTERVAL 3 HOURS)";
0
 

Author Comment

by:pkromer
ID: 18021872
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
 

Author Comment

by:pkromer
ID: 18021884
btw, we are using PHP Version 4.3.10
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 

Author Comment

by:pkromer
ID: 18021895
and MySQL Client API version  4.0.16  
0
 
LVL 30

Accepted Solution

by:
todd_farmer earned 125 total points
ID: 18021910
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
 

Author Comment

by:pkromer
ID: 18021956
perfect. Thank you very much.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Creating and Managing Databases with phpMyAdmin in cPanel.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now