Setting Time Zone for my scripts 
Author Message
 Setting Time Zone for my scripts

Hello all,

Is there an easy way for me to tell PHP to use a time zone for all time
output from a script?  For instance I print to the browser and also add
times to mySQL db inserts and I would like to tell PHP to use GMT - 6:00 to
evaluate current time.

Surely I am missing an obvious an easy way to do this?  Currently I am
subtracting based on known difference between server time and GMT - 6:00 but
I am sure that is a Bad way.

Any help?

jg



Wed, 26 Oct 2005 00:58:11 GMT  
 Setting Time Zone for my scripts


Quote:
> Hello all,

> Is there an easy way for me to tell PHP to use a time zone for all time
> output from a script?  For instance I print to the browser and also add
> times to mySQL db inserts and I would like to tell PHP to use GMT - 6:00
to
> evaluate current time.

> Surely I am missing an obvious an easy way to do this?  Currently I am
> subtracting based on known difference between server time and GMT - 6:00
but
> I am sure that is a Bad way.

Have a look at date() on php.net, especially  the "O" character


Wed, 26 Oct 2005 02:24:14 GMT  
 Setting Time Zone for my scripts
Thank you for the reply.  I have tried using date(O); before but it's out
put is the server's offset from GMT.  Are you suggesting that I use this in
my addtion and subtraction to ascertain the right time?  I can do those
calculations already, what I hope to do is make PHP react as though it were
in a particular rime zone.

Is that possible?

jg


Quote:


> > Hello all,

> > Is there an easy way for me to tell PHP to use a time zone for all time
> > output from a script?  For instance I print to the browser and also add
> > times to mySQL db inserts and I would like to tell PHP to use GMT - 6:00
> to
> > evaluate current time.

> > Surely I am missing an obvious an easy way to do this?  Currently I am
> > subtracting based on known difference between server time and GMT - 6:00
> but
> > I am sure that is a Bad way.

> Have a look at date() on php.net, especially  the "O" character



Wed, 26 Oct 2005 04:00:03 GMT  
 Setting Time Zone for my scripts
php will allways take the servers' time, not the clients, that's just the
way it works.

There is no function in php to get the client's timezone unfortunately.



Quote:
> Thank you for the reply.  I have tried using date(O); before but it's out
> put is the server's offset from GMT.  Are you suggesting that I use this
in
> my addtion and subtraction to ascertain the right time?  I can do those
> calculations already, what I hope to do is make PHP react as though it
were
> in a particular rime zone.

> Is that possible?

> jg





> > > Hello all,

> > > Is there an easy way for me to tell PHP to use a time zone for all
time
> > > output from a script?  For instance I print to the browser and also
add
> > > times to mySQL db inserts and I would like to tell PHP to use GMT -
6:00
> > to
> > > evaluate current time.

> > > Surely I am missing an obvious an easy way to do this?  Currently I am
> > > subtracting based on known difference between server time and GMT -
6:00
> > but
> > > I am sure that is a Bad way.

> > Have a look at date() on php.net, especially  the "O" character



Wed, 26 Oct 2005 08:14:50 GMT  
 Setting Time Zone for my scripts
Thank you for your help!
jg


Quote:
> php will allways take the servers' time, not the clients, that's just the
> way it works.

> There is no function in php to get the client's timezone unfortunately.



> > Thank you for the reply.  I have tried using date(O); before but it's
out
> > put is the server's offset from GMT.  Are you suggesting that I use this
> in
> > my addtion and subtraction to ascertain the right time?  I can do those
> > calculations already, what I hope to do is make PHP react as though it
> were
> > in a particular rime zone.

> > Is that possible?

> > jg





> > > > Hello all,

> > > > Is there an easy way for me to tell PHP to use a time zone for all
> time
> > > > output from a script?  For instance I print to the browser and also
> add
> > > > times to mySQL db inserts and I would like to tell PHP to use GMT -
> 6:00
> > > to
> > > > evaluate current time.

> > > > Surely I am missing an obvious an easy way to do this?  Currently I
am
> > > > subtracting based on known difference between server time and GMT -
> 6:00
> > > but
> > > > I am sure that is a Bad way.

> > > Have a look at date() on php.net, especially  the "O" character



Wed, 26 Oct 2005 21:05:59 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Setting time zone

2. Clock Setting Between Time Zones

3. Time zone conversion script

4. time zones, daylight saving time, and universal time

5. setting time sensors from scripts

6. date_and_time question: can I set zone??

7. Time zone in MVS

8. How to make VW TimeZone use the system time zone automatically

9. Getting Dates with time Zone

10. time zone

11. Programming in other time zone

12. API for Time Zone

 

 
Powered by phpBB® Forum Software