1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Countdown Clock For Shipping - Im banging my head on a brick wall here

Discussion in 'JavaScript' started by donny84, Feb 16, 2011.

  1. #1
    I am trying to create a countdown clock.

    For Example:

    If it's 1:05pm on Friday, it would say:
    "Place your order within the next 6 hours 55 minutes and your order will be delivered on Monday"


    If it's 1:05pm on Saturday, it would say:
    "Place your order within the next 30 hours 55 minutes and your order will be delivered on Tuesday"

    If it's 1:05pm on Sunday, it would say:
    "Place your order within the next 6 hours 55 minutes and your order will be delivered on Tuesday"

    I need to be able to change the cut off point from 8pm if needed...

    It must also ignore bank holiday (Ideally, it would have a section in the code where I could put all 'excluded' dates, e.g. 12/25/2009, 01/01/2010, etc. - This way I could keep it up to date).
    The code must take into account that we only deliver Monday to Friday (Therefore on a Friday after 8pm, it would not say delivery tomorrow, but Monday).
    Once the deadline hits (8pm), the countdown jumps back up to accommodate tomorrow's deadline, etc.


    Also if possible could it say what the date would be delivered also...

    So for example, on Monday the 15th at 1.05pm it would say Place your order within the next 6 hours 55 minutes for delivery on Tuesday the 16th

    Something like amazon uses...

    PLEASE can someone help!

    Someone made this code for me but it is not right...
    <html>
    
    <head>
    
    <script type="text/javascript">
    function ord()
    {
    var c_t = 4;
    
    var dd = new Date();
    
    var ti_h = dd.getHours();
    
    var ti_m = dd.getMinutes();
    
    
    if(ti_h > c_t)
    {
    
    var di_t_h = ti_h - c_t;
    
    var di_t_mi = 60 - ti_m;
    
    var h = 24 - di_t_h;
    
    var mi = di_t_mi;
    
    var mess = h+"hours"+mi+"minutes";
    
    }
    
    
    
    var da = dd.getDay();
    
    //var da = document.getElementById("da").value;
    
    switch(da)
    {
    case 2:
    case 3:
    case 4:
    case 5:
    document.write("Place your order within the next "+mess+"and your order will be delivered tomorrow");
    break;
    case 6:
    case 7:
    case 1:
    document.write("and your order will be delivered on Tuesday");
    break;
    }
    }
    
    ord();
    
    </script>
    
    </head>
    
    <body>
    
    </body>
    
    </html>
    
    HTML:
     
    donny84, Feb 16, 2011 IP
  2. Ryanjc91

    Ryanjc91 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    In the same boat. Did you find a solution?
     
    Ryanjc91, Nov 6, 2017 IP