Jump to content


Photo

british summer time


  • Please log in to reply
8 replies to this topic

#1 j4ymf

j4ymf
  • Members
  • PipPip
  • Member
  • 26 posts
  • Locationleicestershire, england

Posted 29 March 2006 - 05:50 PM

hello i use this code

[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]$now = date("G:i a");[!--colorc--][/span][!--/colorc--]

but because the clocks have changed the time i am showing is an hour wrong any ideas?


can i do somthing like G+1


thanks jason


#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 29 March 2006 - 05:53 PM

You're going to have to use the mktime() function to add an hour. However, I suggest you figure out something in terms of server configuration otherwise you'll have problems when the time changes back.

Info: PHP Manual


#3 j4ymf

j4ymf
  • Members
  • PipPip
  • Member
  • 26 posts
  • Locationleicestershire, england

Posted 29 March 2006 - 05:55 PM

[!--quoteo(post=359742:date=Mar 29 2006, 05:53 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Mar 29 2006, 05:53 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
You're going to have to use the mktime() function to add an hour. However, I suggest you figure out something in terms of server configuration otherwise you'll have problems when the time changes back.
[/quote]

thankyou i will look into it

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 29 March 2006 - 06:02 PM

PHP gets the time from the server itself. The servers clock should be configured to update automatically it should add an hour or take an hour away when the clocks go forward or back this process is automatic so you shouldn't have to worry about adding/removing hours from your times.

SO I would look into your how your server is configured. All PC/Laptops/Servers or what ever shoud do this. I think computers/servers will only do this if a setting called Daylight saving changes is set.

#5 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 29 March 2006 - 06:18 PM

wildteen, I'm going to assume that "british summer time" is different from DST. The clocks don't change here for another week or so. This all may be dependent on where the server is physically located.

Info: PHP Manual


#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 29 March 2006 - 06:27 PM

Yeah I guess j4ymf is absed in the UK like me but his site may be hosted in another time zone otherthan GMT. Didn't think of that.

#7 j4ymf

j4ymf
  • Members
  • PipPip
  • Member
  • 26 posts
  • Locationleicestershire, england

Posted 29 March 2006 - 07:32 PM

hello ive got round it
[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]echo date('G:i a', strtotime('+1 hour'));[!--colorc--][/span][!--/colorc--]

so do i need to ask my host where there server is based, if it is in the uk it should do its self am i right?





this is the reply i got from my server

Our servers, like practically all other internet servers, run on UTC/GMT. If you wish your site to display the time in British Summer Time, you will need to adjust your script.

so what does this mean??



#8 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 29 March 2006 - 08:14 PM

That means that you should either put something in your script to detect when it goes past date x and calculate the date accordingly. Either that or you'll have to update the script everytime the time shifts.

OR... you could take the date off of your site completely and let your users get the date and time from their own computers!

OR you could post the time and specify that it's based off of GMT.

Info: PHP Manual


#9 j4ymf

j4ymf
  • Members
  • PipPip
  • Member
  • 26 posts
  • Locationleicestershire, england

Posted 29 March 2006 - 08:18 PM

thankyou very much for your help




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users