Jump to content


Photo

Get current time


  • Please log in to reply
3 replies to this topic

#1 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 10 April 2006 - 10:38 AM

Hi

I want to add a NOW ON AIR LIVE notification to my website. Basically I need to check the current time and then check to see if this time matches or is between thursday 7pm and thursday 10 pm.

I have no idea how to check the time within a time span....any ideas?

Thanks

Will
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 10 April 2006 - 11:24 AM

This will get you started. You might prefer to use the GMT functions. Allow for the offset between your local time and the time zone for your server.
$day_of_the_week = date("W"); // Sunday=0, Monday=1 etc.
$hour_of_the_day = date("G");// 0-23

Legend has it that reading the manual never killed anyone.
My site

#3 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 10 April 2006 - 11:55 AM

Thanks Andy

I was going at it in a for more complicated manner....not separating the days and the hours. I looked at your response and thought...bloody hell hes missed the point!

BUT...as ever....I was wrong and when I re-read it....the obvious became clear.

If only comon sennse was common practice.

Thanks Mate

Will
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 10 April 2006 - 12:39 PM

Yup, sometimes all it takes is another way of looking at the problem.
Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users