Time Help

This is a discussion on Time Help within the PHP Language forums, part of the PHP Programming Forums category; Hello, I have this script and it shows GMT time and I need it to show -8 GMT for PST ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-13-2007
John
 
Posts: n/a
Default Time Help

Hello,


I have this script and it shows GMT time and I need it to show -8 GMT
for PST time.


Here is the code that needs changing.


( "F j, Y g:ia T", $row[date] )




What do I change to get it to -8?


Any help would be appreciated.
Reply With Quote
  #2 (permalink)  
Old 12-13-2007
macca
 
Posts: n/a
Default Re: Time Help

gmstrftime()


http://www.php.net/gmstrftime
Reply With Quote
  #3 (permalink)  
Old 12-14-2007
John
 
Posts: n/a
Default Re: Time Help

On Thu, 13 Dec 2007 15:29:19 -0800 (PST), macca
<ptmcnally@googlemail.com> wrote:

>gmstrftime()
>
>
>http://www.php.net/gmstrftime



I just need an example as I looked at the site and I'm not good with
PHP.



Reply With Quote
  #4 (permalink)  
Old 12-14-2007
Janwillem Borleffs
 
Posts: n/a
Default Re: Time Help

John schreef:
> On Thu, 13 Dec 2007 15:29:19 -0800 (PST), macca
> <ptmcnally@googlemail.com> wrote:
>
>> gmstrftime()
>>
>>
>> http://www.php.net/gmstrftime

>
>
> I just need an example as I looked at the site and I'm not good with
> PHP.
>


The example is quite obvious, what is it that you don't understand?


JW
Reply With Quote
  #5 (permalink)  
Old 12-14-2007
Toby A Inkster
 
Posts: n/a
Default Re: Time Help

John wrote:
> ( "F j, Y g:ia T", $row[date] )
> What do I change to get it to -8?



( "F j, Y g:ia T", $row[date] - 8*3600 )

i.e. subtract 8 hours (an hour is 3600 seconds) from the time before
displaying it.

There might be some funniness around daylight savings, but there's always
funniness around then. This is why I think daylight savings, and perhaps
even time zones as a whole, should be abolished. Everyone should just use
UTC for everything all the time.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 6 days, 20:54.]

Sharing Music with Apple iTunes
http://tobyinkster.co.uk/blog/2007/1...tunes-sharing/
Reply With Quote
  #6 (permalink)  
Old 12-14-2007
John
 
Posts: n/a
Default Re: Time Help


Thank you Toby for the example.

This is exactly what I needed.

>
>( "F j, Y g:ia T", $row[date] - 8*3600 )
>
>i.e. subtract 8 hours (an hour is 3600 seconds) from the time before
>displaying it.
>


Reply With Quote
  #7 (permalink)  
Old 12-14-2007
John
 
Posts: n/a
Default Re: Time Help

One more quick question. How do I make say PST instead of GMT?

>John wrote:
>> ( "F j, Y g:ia T", $row[date] )
>> What do I change to get it to -8?

>
>
>( "F j, Y g:ia T", $row[date] - 8*3600 )
>
>i.e. subtract 8 hours (an hour is 3600 seconds) from the time before
>displaying it.
>
>There might be some funniness around daylight savings, but there's always
>funniness around then. This is why I think daylight savings, and perhaps
>even time zones as a whole, should be abolished. Everyone should just use
>UTC for everything all the time.


Reply With Quote
  #8 (permalink)  
Old 12-15-2007
macca
 
Posts: n/a
Default Re: Time Help

My god man RTFM!

You could use

timezone_offset_get()

The examples are on the page http://www.php.net/timezone_offset_get()
so i cant be bothered typing it out for you.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:26 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0