Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> Timezone Stuff

This is a discussion on Timezone Stuff, within the MySQL section. This forum and the thread "Timezone Stuff" are both part of the Programming Your Website category.

 
Reply to this topicStart new topic
> Timezone Stuff, select events within the next 24 hours and also calculate the timezone
cosmicbdog
post Oct 22 2008, 07:23 AM
Post #1


Rapid Squeezer
****

Posts: 146
Joined: 3-July 08


Basically I have a table that stores the datetime '0000-00-00 00:00:00' format for events coming up. We also store a timezoneoffset e.g '-10' or '10' since we are runnings events in different regions of the world.

We run cron jobs like 24 hours before an event, reminding our bookings with the event information. But until now, we haven't had timezone off-setting so that people in places other than the timezone of the server are getting their stuff at the right time.

I am wondering if its possible to apply the timezone to the stored datetime within the query...

CURRENTLY WITHOUT UTC STUFF:
CODE
SELECT * FROM events
WHERE events.startDateTime > DATE_ADD(NOW(), INTERVAL -24 HOUR)




IN AN IDEAL WORLD
CODE
SELECT * FROM events
WHERE DATE_DIFF(events.startDateTime, HOUR(events.timezoneoffset)) > DATE_ADD(NOW(), INTERVAL -24 HOUR)


MY silly logic here is that hopefully that DATE_DIFF would add the timezoneoffset to the startDateTime. Am I missing something here or is there a way to do this?
Go to the top of the page
 
+Quote Post
cosmicbdog
post Oct 22 2008, 08:56 AM
Post #2


Rapid Squeezer
****

Posts: 146
Joined: 3-July 08


I'm also trying something like
CODE
SELECT * FROM events
                                WHERE events.startDateTime < NOW()
                                AND DATE_ADD(events.startDateTime, INTERVAL events.timezoneoffset HOUR) > DATE_ADD(NOW(), INTERVAL -1 MONTH)
                                ORDER BY events.startDateTime DESC

Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts 0 Daniel 423 25th February 2008 - 04:22 PM
Last post by: Daniel
No New Posts   3 Mark 246 6th March 2008 - 11:10 PM
Last post by: Monie
No New Posts   9 JustinStudios 299 29th April 2008 - 11:19 AM
Last post by: c010depunkk
No New Posts   4 djeyewater 298 15th May 2008 - 02:08 PM
Last post by: djeyewater
No New Posts   6 c010depunkk 144 28th May 2008 - 06:43 PM
Last post by: Mark Poppen