Solved

need to change second value to minutes

Posted on 2000-04-07
1
154 Views
Last Modified: 2013-12-24
I previously posted a question on comparing 2 dates together to get a value that represents the differance.

I think I am getting closer to solving the problem but I still need help with one final part.

I need to track the time in minutes/seconds that a user has been on a page

I have 2 times one time is subtracted from the other and I am able to get a value of seconds or minutes.  The problem with minutes is that it is not acurate enough. I need the answer to show seconds also.  I can get the total second but then I cannot convert the seconds to show the time as minutes and seconds (output should look like this- 1:35)

Here is my code so far
<HTML>
<BODY>

<CFSET Variables.date1 = "07 Apr 12:39:56">
<CFSET Variables.date2 = "07 Apr 12:35:59">

<CFSET Variables.differenceSec = "#Abs(DateDiff("s", Variables.date1, Variables.date2))#">

The duration is <CFOUTPUT>#Variables.differenceSec#</CFOUTPUT>

</BODY>
</HTML>      


When I divide the Variables.differenceSec by 60 I get the wrong answer it looks like this 3.6788784

How do I convert a number like 237 seconds to display the equivelent time in minutes and seconds?
0
Comment
Question by:jacqueschoquette
1 Comment
 
LVL 2

Accepted Solution

by:
paulkd earned 75 total points
ID: 2695240
<HTML>
<BODY>

<CFSET Variables.date1 = "07 Apr 12:39:56">
<CFSET Variables.date2 = "07 Apr 12:35:59">

<CFSET Variables.differenceSec = "#Abs(DateDiff("s", Variables.date1, Variables.date2))#">

<CFSET Minutes=int(Variables.differenceSec/60)>
<CFSET Seconds=(Variables.differenceSec mod 60)>

The duration is <CFOUTPUT>#Minutes# Minutes and #Seconds# Seconds.


</CFOUTPUT>

</BODY>
</HTML>        
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now