Unix Programming - PHP date question [html image swapping based on time]

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > PHP date question [html image swapping based on time]





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author PHP date question [html image swapping based on time]
Eric

2004-01-23, 5:36 pm

Hello,
I'm a php moron....I need some php code that detects what time it is
and displayes an one of two images based on time.

I'd like one picture to be displayed between the hours of 7:00AM and
7:00 PM and one image to display during the other off hours.

Any ideas...I've been messing wiht php and I can't even get a date
generated..

thanks

ericlangland@hotmail.com
Frank Hickman

2004-01-23, 5:36 pm

Not really the right group for this but you can do it this way...

<?php
$dt= getdate();
echo '<img border="0" src=';
if ( $dt['hours'] >= 7 && $dt['hours'] <= 19 )
echo '"images/dayimage.jpg"';
else
echo '"images/nightimage.jpg"';
echo ' width="64" height="64">'
?>

HTH
--
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.


"Eric" <ericlangland@hotmail.com> wrote in message
news:5372437.0401222214.492ef8ec@posting.google.com...
quote:

> Hello,
> I'm a php moron....I need some php code that detects what time it is
> and displayes an one of two images based on time.
>
> I'd like one picture to be displayed between the hours of 7:00AM and
> 7:00 PM and one image to display during the other off hours.
>
> Any ideas...I've been messing wiht php and I can't even get a date
> generated..
>
> thanks
>
> ericlangland@hotmail.com




Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com