?
Solved

need to change second value to minutes

Posted on 2000-04-07
1
Medium Priority
?
161 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
paulkd earned 300 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

762 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