1. This website uses cookies to improve service and provide a tailored user experience. By using this site, you agree to this use. See our Cookie Policy.
    Dismiss Notice

Could anybody write a simple timer thing?

Discussion in 'PHP & Perl' started by menly, Jul 17, 2009.

  1. menly

    menly Registered Member

    Nov 22, 2008
    Likes Received:
    Nottingham UK
    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!

  2. cyklotrial

    cyklotrial Regular Member

    Oct 13, 2008
    Likes Received:
    00:00 - 10:59 it will show how many times left.
    11:00 - 23:59 it will show nothing :p
    "11:00";//11:00 AM
    $now date("H:i");
    $left = (strtotime($time) - strtotime($now))/60;


    'If you place your order within the next '.$h.' hours '.$m.' minutes it will be dispatched today!';