Jump to content


Photo

Date calculation on two variables


  • Please log in to reply
1 reply to this topic

#1 playaz

playaz
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 25 July 2006 - 01:34 PM

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

#2 hussain

hussain
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 25 July 2006 - 01:48 PM

hi am hussain

try this

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users