SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2005
    Location
    Orange County, CA, Unites States
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Countdown - Similar to Amazon.com's?

    Hey everyone,

    I'm wondering if someone can help me out. For my ecommerce site I would like to add a countdown timer. On amazon.com they display the following:

    Want it delivered Tuesday, January 9? Order it in the next 35 hours and 37 minutes, and choose One-Day Shipping at checkout. See details

    I found this thread here:

    http://forums.digitalpoint.com/showt...ight=countdown

    But it doesn't do exactly what I need. The codes on that page will display a countdown... but I have more variables.

    The biggest issue comes down to days of the week. For example... if I want people to order by 9 AM to get their orders the next day... I can't have my site show a user at 8 am on saturday that if he orders within 1 hour he'll get it on Sunday (UPS doesn't ship or delivery on Saturday or Sunday).

    So... I would need to set some variable where if it's Saturday at 8 and a users views a page it would change to:

    Want it delivered next Tuesday? Order it in the next 1 hours, and choose One-Day Shipping at checkout. See details

    If they are on the site Sunday at 8 AM it will say the same thing. Same as on Monday. But on Tuesday it would say:

    Want it delivered on Wednesday? Order it in the next 1 hours, and choose One-Day Shipping at checkout. See details

    Make sense? Can anyone help me out or point me in the right direction? I'm not an ASP programmer but if I'm given a starting point I can play around with the code for a while to hopefully get it working the way I want

  2. #2
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    First you need to figure out what day of the week it is. Here is a quick tutorial for that:

    http://www.plus2net.com/asp-tutorial/date-day.php

    So if the day of the week is 1 (sun)or 7 (sat) then display "will arrive on Tuesday"

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2005
    Location
    Orange County, CA, Unites States
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Thing. So I got the following code working:

    <&#37; If WeekDay(d_mydate) = 2 AND Hour(Now) < 12 then %>
    Want your order delivered by Tuesday? Order in the next ****** and choose next day air as your shipping method.
    <% End If %>

    But I need to replace ********* with the exact number of hours and or minutes until it expires. I've done some searching and found the function DateDiff, but I need to find something in regards to time (which I don't see anything like "TimeDiff" available.

    Is there a way in classic ASP to give the current time and an end time and have the page display to the user a countdown in Hours and minutes?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •