On Nov 23, 2009, at 7:37 PM, Don Wieland wrote: > Hello, > > I have a mySQL database server in Florida USA (EST) and I want to do a query > on a record in California, USA (PST) 3 hours earlier using PST instead of EST. > > I would like to add to my CORE page that offset of the timezone so I can use > it in a query like: > > Select * FROM aTable WHERE ServerOffsetTimeStap >= Row_Start_TimeStamp AND > ServerOffsetTimeStap <= Row_End_TimeStamp > > How would I do this? > > Appreciate any help you can offer. Thanks!
When I store timestamps, I store them in GMT time. This way, no matter when you pull it out of the database, you *know* when it was stored - even in a different timezone. To achieve this... <?php // Put this into the database $timeIntoDb = time() - date("Z"); // Pull this from the database $ts = $timeFromDb + date("Z"); ?> Maybe this will make it a little easier to query accordingly...? Hope this stirs your brain. ~Philip PS... Others may profess that you use UTC instead of GMT, but that's a different thread. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php