Page 1 of 1

Need Help with Time() <<--Beginner :(

Posted: Tue Jun 10, 2008 11:58 am
by Ninjataktikz
Hi Guys,
Just joined today. I'm taking a class this summer to finish my A.S in Database Management. Well lets get to the problem. My first hw assignment that I got yesterday is done. But I am having problem with one thing the Extra Credit. So here it is.

Code: Select all

 
<HTML>
<HEAD>
<TITLE>CISW 410 Index</TITLE>
</HEAD>
<BODY BGCOLOR="#EOEOEO">
<CENTER><H1><FONT COLOR="RED">Haninder Bhatti @ CRC</FONT></H1><H3>CISP 410 (Middleware Web Scripting) - Summer 2008 - Fishman</H3>
</CENTER><BR><HR><BR><P><B>ASSIGNMENTS:</B></P><OL><LI>Assignment #1 - Basic Page with Links</LI>
<LI>Assignment #2 - Index Page</LI>
<LI>Assignment #3 - Graphics</LI>
<LI>Assignment #4 - Tables & Frames</LI>
</OL>
<center>
<br />
<br />
<br />
<?php
    $day= date('l, F d, Y');
        echo ("$day");
?>
</center>
</BODY>
</HTML>
 
Its Beginning PHP. I am trying to come up with a code that would change the Background color to Black and Font color to White from 6 P.M. to 6 A.M. I know its a If Then statement but I cannot figure out what the time format and how would I tell the program that it is 6 P.M. I'm really confused right now. I google'd a lot but came up with the code to change Background on certain Days and not Time. Please help me with this.

Thank You

Gary

Re: Need Help with Time() <<--Beginner :(

Posted: Tue Jun 10, 2008 12:23 pm
by superdezign
Check the time, then. :P

Code: Select all

$hour = (int)date('G');
if (($hour >= 6) && ($hour < 18)) {
  // Between 6AM and 6PM, including 6AM
} else {
  // Between 6PM and 6AM, including 6PM
}

Re: Need Help with Time() <<--Beginner :(

Posted: Tue Jun 10, 2008 1:34 pm
by Ninjataktikz
superdezign wrote:Check the time, then. :P

Code: Select all

$hour = (int)date('G');
if (($hour >= 6) && ($hour < 18)) {
  // Between 6AM and 6PM, including 6AM
} else {
  // Between 6PM and 6AM, including 6PM
}
Thank You for taking your time to help me out with this Superdezign. It worked like a Charm. Thank You.

Gary