Jump to content

Archived

This topic is now archived and is closed to further replies.

playaz

Date calculation on two variables

Recommended Posts

Hi guys,
I have a serious of forms on a site, basically when the form is created it puts the time in a field called 'created_date' in the DB (MySQL) similarly once the process is completed it puts the time in a field called 'completed_date'.

How can I calculate the time difference between the two columns within the row in the db?
e.g.
created-date - 2006-07-22 13:15:39
completed_date - 2006-07-25 14:24:35

How do I work out the difference between the two?

Thanks in advance :)

Share this post


Link to post
Share on other sites
hi am hussain

try this

$elapsed=strtotime($entertime)-strtotime($completetime);
$totalelapsed= gmdate("H:i:s",$elapsed);

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.