0

Hello Friends..
there is a time Duration field in my page..!!
in format
mins:sec
03:45
05:11
.
.
i want o show total of all time duration in last...!!
.
.
is there any predefined function to do this..!!
.
.
thanks..!! :)

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by innocent.boys
0

Hello Friends..
there is a time Duration field in my page..!!
in format
mins:sec
03:45
05:11
.
.
i want o show total of all time duration in last...!!
.
.
is there any predefined function to do this..!!
.
.
thanks..!! :)

Do you want this like a clock to continually update or just when a new page is loaded?

php could do the latter without using javascript via a cookie or session variable or even through a database value

In every page:

session_start();
//set the current time in seconds - unix timestamp
$now = time();

//set the session variable if not already set
if(!isset($_SESSION['start']))$_SESSION['start'] = $now;


//this will give you the number of seconds since the first page was accessed
$diff = $now - $_SESSION['start'];

//you can now do the simple arithmetic yourself.

if you wanted to do the former, i'd suggest using javascript and not really bothering with php at all.

0

there is a field in named 'Time Duration' in my table..!! all i just want to calculate total Duration in end..!!! and it must be in minutes..!!! there are logics on which i worked... but still i m lookin for any php function through which i can do easily..!! :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.