Login | Register  

Converting seconds to hours, minutes and seconds

by Scud   Thursday, August 03, 2006 Rating:
 Vote this news:


This is a comple sample code which converts seconds to time. We could use this code to display a web client how many hours and minutes browsed on our website. But here our aim is juts to convert seconds to hours. Rest of coding will be your choise.

Step I
First we need to create some variables and set the first values as zero

Dim intFHours, intFMin, intFSec, intUserSeconds
intFHours = 0
intFMin = 0
intFSec = 0
intUserSeconds = 8551 ' Our first value, you need to set first modified value after calling ffrom another operation!


Step II

intFHours = intSec\\3600
intFMin = (intUserSeconds MOD 3600)\\60
intFSec = (intUserSeconds MOD 3600) MOD 60

Step III
As seen on step 2 , we have converted seconds to hours and msnutes and we have handled some new values and passed them our variables. What's next?

Just write it on page wherever you want to display it
response.write ("You browsing time is : " &
intFHours & " hours, " & intFMin & " minutes and " & intFSec & " seconds")


This is cool code focus and can be used on many development parts.

Happy Coding




Dotnetindex.com is listed with 411asp.net
Dotnetindex.com is listed with aspin.com
Dotnetindex.com is listed with jspin.com
PHP, ASP, .NET, JSP Resources, Reviews







page counter
Copyright © 2007 Powered by GNews Publisher Positive. All rights reserved. Contact Us - Load Time: 0.23 second(s)