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..!! :)

Recommended Answers

All 2 Replies

Member Avatar for diafol

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.

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..!! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.