Could anybody write a simple timer thing?

menly

Registered Member
Joined
Nov 22, 2008
Messages
81
Reaction score
22
Hey guys,

Looking for a massive favour of somebody if they don't mind (you'd have my eternal gratitude, I'd hit the thanks button, and I'd give you 1 sexual favour :D ).

You know how on amazon, on certain items it says "If you order this within the next 2hours 25minutes you'll recieve it tomorrow" or words to that effect, I'm after something a little like that for my new online store. I know this must be a dead simple bit of code, and anybody who knows their way around php could do it in like 2minutes.

Basically, on the new online store I'm working on, orders placed before 11am (GMT) are despatched the same day, and I'd like to be able to display that in a timer like on amazon. So, for example at 7.25am it'll say:

"If you place your order within the next 3hours 35minutes it will be dispatched today!

After 11am, I'd like it to disappear (so no text is displayed), then reappear at say midnight (basically I don't want it being displayed if you've missed the 11am cut off for that day).

I'm pretty sure its a dead simple job (and that I've described it in a really poor way - I'm hoping somebody can work out what I mean), but if its actually fairly complex please let me know and I'll just get a freelancer to do it for a few $$$. BUUUUT, I'd be so eternally greatful if anybody could do it for me on here!

Thanks BHW!

Dan
 
00:00 - 10:59 it will show how many times left.
11:00 - 23:59 it will show nothing :P
PHP:
<?php
$time = "11:00";//11:00 AM
$now = date("H:i");
$left = (strtotime($time) - strtotime($now))/60;

$h=floor($left/60);
$m=floor($left%60);

if($left>0)
	{
	echo 'If you place your order within the next '.$h.' hours '.$m.' minutes it will be dispatched today!';
	}
?>

Regards
Lukas
 
Back
Top