Query based on Server offset TimeStamp

Query based on Server offset TimeStamp

am 24.11.2009 02:37:57 von Don Wieland

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!


Don Wieland
D W D a t a C o n c e p t s
~~~~~~~~~~~~~~~~~~~~~~~~~
donw@dwdataconcepts.com
Direct Line - (949) 305-2771

Integrated data solutions to fit your business needs.

Need assistance in dialing in your FileMaker solution? Check out our
Developer Support Plan at:
http://www.dwdataconcepts.com/DevSup.html

Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro
9 or higher
http://www.appointment10.com

For a quick overview -
http://www.appointment10.com/Appt10_Promo/Overview.html


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Query based on Server offset TimeStamp

am 24.11.2009 05:13:35 von Philip Thompson

On Nov 23, 2009, at 7:37 PM, Don Wieland wrote:

> Hello,
>=20
> 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.
>=20
> I would like to add to my CORE page that offset of the timezone so I =
can use it in a query like:
>=20
> Select * FROM aTable WHERE ServerOffsetTimeStap >=3D =
Row_Start_TimeStamp AND ServerOffsetTimeStap <=3D Row_End_TimeStamp
>=20
> How would I do this?
>=20
> 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...

// Put this into the database
$timeIntoDb =3D time() - date("Z");

// Pull this from the database
$ts =3D $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