That gives you the number of seconds between now and then... based on your
script. You can then parse the seconds value and figure out how many Days,
hours and minutes are left...
The following snippet might not be the most efficient... but it works... ;-)
You could probably make this a custom function or custom tag as well.
<CFSCRIPT>
timeleft = DateDiff("s", Now(), deadline);
daystogo = Int(timeleft /86400);
leftover1 = timeleft - (daystogo * 86400);
hourstogo = Int(leftover1/1440);
leftover2 = leftover1 - (hourstogo * 1440);
minutestogo= Int(leftover2/60);
leftover3 = leftover2 - (minutestogo * 60);
secondstogo = leftover3;
</CFSCRIPT>
<CFOUTPUT>
#daystogo# days<BR>
#NumberFormat(hourstogo, '00')# Hours<BR>
#NumberFormat(minutestogo, '00')# minutes<BR>
#NumberFormat(secondstogo, '00')# seconds<BR>
</CFOUTPUT>
HTH,
Jeff
----- Original Message -----
From: "Dave Lyons" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, February 13, 2003 3:22 PM
Subject: Re: OK, lets start over........Re: any ideas on this error?
ok, that may work
solves the error and returns this: 159679
so should i just format that? to show the time left?
Dave
----- Original Message -----
From: <"Everett>; <Al <[EMAIL PROTECTED]>>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, February 13, 2003 5:17 PM
Subject: RE: OK, lets start over........Re: any ideas on this error?
> Try this: <cfset timeLeft = DateDiff("s", Now(), deadline)>
>
> > -----Original Message-----
> > From: Dave Lyons [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, February 13, 2003 5:00 PM
> > To: CF-Talk
> > Subject: OK, lets start over........Re: any ideas on this error?
> >
> >
> > heres what i need
> >
> > i have to make this small auction page for my competitors client.
> > what i need right now is to be able to show on the details
> > page how much
> > time is left before the end of the auction.
> > see: http://www.real-singles.com/auctionCFM/detail.cfm?auctionID=25
> >
> > ok, so in my application.cfm template i have this variable set:
> > <cfset deadline = createDateTime(2003, 2, 15, 13, 42, 0)>
> >
> > the reason for this is that i need this to manually set the
> > end time of the
> > auction on all of the pages.
> > they arent paying enough to make it dynamic and they want
> > each auction to
> > start and end all at the same time, just a 1 shot deal.
> > but I figure i should use this for what i need now.
> >
> > so on the details page i need to basically show how much time
> > is left, just
> > like Ebay:)
> >
> > thats where dateDiff comes in, correct?
> >
> > which should be like such
> > <cfset timeLeft = DateDiff("datepart", "date1", "date2")>
> >
> > so i was thinking that Now() should go where "date1" is
> > And "deadline" from the application.cfm should go where "date2" is
> > tony i think you may be right in putting 's' in where "datePart" is
> >
> > which now looks like
> >
> > <cfset timeLeft = DateDiff("'s'", "Now()", "deadline")>
> >
> > and that produces this error
> >
> > Parameter validation error for function DATEDIFF.
> > The value of the parameter 2, which is currently
> > "Now()", must be a
> > class java.util.Date value.
> >
> > The error occurred in
> > C:\Inetpub\wwwroot\auctionCFM\datediff.cfm: line
> > 14
> >
> > 12 :
> > 13 : <body>
> > 14 : <cfset timeLeft = DateDiff("'s'", "Now()", "deadline")>
> > 15 :
> > 16 :
> >
> >
> >
> >
> >
> >
> >
> >
> > Dave
> >
> > ----- Original Message -----
> > From: "Tony Weeg" <[EMAIL PROTECTED]>
> > To: "CF-Talk" <[EMAIL PROTECTED]>
> > Sent: Thursday, February 13, 2003 4:40 PM
> > Subject: RE: any ideas on this error?
> >
> >
> > > send the code ur using....
> > >
> > > ...tony
> > >
> > > Tony Weeg
> > > Senior Web Developer
> > > UnCertified Advanced ColdFusion Developer
> > > Information System Design
> > > Navtrak, Inc.
> > > Mobile workforce monitoring, mapping & reporting
> > > www.navtrak.net
> > > 410.548.2337
> > >
> > > -----Original Message-----
> > > From: Dave Lyons [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, February 13, 2003 4:36 PM
> > > To: CF-Talk
> > > Subject: Re: any ideas on this error?
> > >
> > >
> > > using just Now() throws the same error
> > >
> > >
> > > Dave
> > >
> > > ----- Original Message -----
> > > From: "Tony Weeg" <[EMAIL PROTECTED]>
> > > To: "CF-Talk" <[EMAIL PROTECTED]>
> > > Sent: Thursday, February 13, 2003 4:30 PM
> > > Subject: RE: any ideas on this error?
> > >
> > >
> > > > why use all that....can u just use
> > > >
> > > > Now()
> > > >
> > > > ...tony
> > > >
> > > > Tony Weeg
> > > > Senior Web Developer
> > > > UnCertified Advanced ColdFusion Developer
> > > > Information System Design
> > > > Navtrak, Inc.
> > > > Mobile workforce monitoring, mapping & reporting
> > > > www.navtrak.net
> > > > 410.548.2337
> > > >
> > > > -----Original Message-----
> > > > From: Dave Lyons [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, February 13, 2003 4:26 PM
> > > > To: CF-Talk
> > > > Subject: any ideas on this error?
> > > >
> > > >
> > > > Parameter validation error for function DATEDIFF.
> > > > The value of the parameter 2, which is currently
> > > > "CreateDateTime(Now())", must be a class java.util.Date value.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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