I suspect the code you posted may not reflect what you're using.  In any case, I
wouldn't recommend doing all the comparisons of days, hours, minutes and seconds
to tell if an auction has ended.  You've got the end date/time ("deadline") and
you know what the current date/time are (Now()).  Just compare the two and be
done with it.  Use the modulo operator to break the time left into days, hours,
minutes, seconds.


<cfset deadline = "02/18/2003 10:28 PM">

<cfscript>

dtogo = DateDiff("d", Now(), deadline);
htogo = DateDiff("h", Now(), deadline) mod 24;
mtogo = DateDiff("n", Now(), deadline) mod 60;
stogo = DateDiff("s", Now(), deadline) mod 60;
</cfscript>

<cfif Now() gte deadline>
  Too late.  The auction has ended.<br>
  Days: 0<br>
  Hours: 0<br>
  Minutes: 0<br>
  Seconds: 0<br>
<cfelse>

  <cfoutput>
  Days: <cfif dtogo lt 1>Last Day!<cfelse>#dtogo#</cfif><br>
  Hours: <cfif htogo lt 1>Last Hour!<cfelse>#htogo#</cfif><br>
  Minutes: <cfif mtogo lt 1>Last Minute!<cfelse>#mtogo#</cfif><br>
  Seconds: #stogo#<br>
  </cfoutput>
</cfif>


Jim


----- Original Message -----
From: "Dave Lyons" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, February 17, 2003 5:23 PM
Subject: Re: i shall ask 1 more time (works for me)


> oh lol
> thanks
>
>
>
> ----- Original Message -----
> From: "Ryan Kime" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Monday, February 17, 2003 10:09 AM
> Subject: RE: i shall ask 1 more time (works for me)
>
>
> > Just to add in something to cfdev's email, make sure you use the proper
> form
> > of "TO". Especially if it is for a client.
> >
> >  <strong>To Late</strong>
> >
> > Should be:
> >
> >  <strong>Too Late</strong>
> >
> >
> > -----Original Message-----
> > From: CFDEV [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, February 17, 2003 8:51 AM
> > To: CF-Talk
> > Subject: RE: i shall ask 1 more time (works for me)
> >
> >
> > This is what I used and it works for me.
> > Once it is 0 time remaining, it shows, too late:
> >
> >
> > <cfset deadline = "02/17/2003 9:50 AM">
> > <CFSCRIPT>
> > timeleft = DateDiff("s", Now(), deadline);
> > daystogo = Int(timeleft /86400);
> > leftover1 = timeleft - (daystogo * 86400);
> > hourstogo = Int(leftover1/3600);
> > leftover2 = leftover1 - (hourstogo * 3600);
> > minutestogo= Int(leftover2/60);
> > leftover3 = leftover2 - (minutestogo * 60);
> > secondstogo = leftover3;
> > </CFSCRIPT>
> >
> >
> > <cfif daystogo LT 1 AND hourstogo IS 00 AND minutestogo IS 00 AND
> > secondstogo IS 00>
> > <strong>To Late</strong>
> > <cfelse>
> >     <cfoutput>
> > #NumberFormat(daystogo,'00')# Days<br>
> > #NumberFormat(hourstogo,'00')# Hours<br>
> > #NumberFormat(minutestogo,'00')# Minutes<br>
> > #NumberFormat(secondstogo,'00')# seconds
> > </cfoutput>
> > </cfif>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to