This works,
<cfset finishtime = "11:00:00">
<cfset timeremaining = Now()>
<cfset hoursremaining = DateDiff("h", TimeFormat(Now(), "hh:mm:ss"),
finishtime)>
<cfset minutesremaining = DateDiff("n", TimeFormat(Now(), "hh:mm:ss"),
finishtime)>
<cfif minutesremaining gte "60">
<cfset minutesremaining = minutesremaining - 60>
</cfif>
<cfset timeremaining = hoursremaining & ":" & minutesremaining>
<cfoutput>
#finishtime# #timeremaining#<br />
</cfoutput>
- Wil Genoveses
> have a page in my application where I want to refresh the screen
> every 60 seconds without the user having to click enter - so I have
> used the <meta http-equiv="refresh" content="60" /> and it seems to
> work well.
>
> Basically I want to display a clock of sessions with Gym
> instructors/Personal Trainers.
>
> In my db i have the field finishtime which is stored. I have 2 records
> in the file one has the finish time as 17:00:00 and the other has the
> finish time as 18:00:00
>
> The system time is displayed on the screen as:
>
> 05:54:49 PM
>
> My results on the screen are:
>
> Finish Time Time Remaining
> 04:20:00 PM 10:25:11
> 06:00:00 PM 12:05:11
>
> These time are somewhat out and I cant figure out why. I think I have
> taken the correct aproach but if anyone can advise on a better
> approach that would be much appreciated.
>
> I have checked the program again with the time now
> 06:00:30 PM and the time remaining now shows as 58:29 when it should
> simply say 1:30 overtime
>
>
>
> My code is:
>
>
> <cfset timeremaining = 0>
> <cfset timeremaining = Now()>
> <cfset timeremaining = qgetbookings.finishtime - TimeFormat(Now(),
> "hh:mm:ss")>
> #timeformat (timeremaining, "hh:mm:ss")#
>
>
>
> Thanks in advance for any thoughts/feedback
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:288476
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4