Hi guys...

I need a PHP code which will display a hyperlink only between 8:00 am - 8:00 pm.

Thanks.

Recommended Answers

All 3 Replies

In something I'm working on this week I have

$cutoff = strtotime("2010-07-20 00:59"); 
$now = mktime();
if ($now<$cutoff) {
 //do something until cutoff
}
<?
	$currTime = date('H:i');
	if($currTime >= "08:00" && $currTime <= "20:00")
	{
		?><a href="#">Time is between 8:00 am - 8:00 pm.</a><?
	}
?>

Try this code.

<?
	$currTime = date('H:i');
	if($currTime >= "08:00" && $currTime <= "20:00")
	{
		?><a href="#">Time is between 8:00 am - 8:00 pm.</a><?
	}
?>

Try this code.

Nicely done!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.