0

Possible Duplicate:
How to get time difference in minutes in PHP

i have been trying to get the time of a certain process but i want to compare it with the current time, i mean i want to get the total difference between when the process started, here at this blog : php get process creation time

this guy has told the procedure to get the process timing, its working fine, but i am only stuck at comparing the time to current time!!

Is there any solution for this? or any alternative?

Community
  • 1
  • 1
  • 5
    What you have tried ? paste some code ? – GBD Oct 05 '12 at 17:32
  • 1
    I think this question has already been answered: http://stackoverflow.com/questions/365191/how-to-get-time-difference-in-minutes-in-php – user1721082 Oct 05 '12 at 17:34
  • Agreed, more explanation is needed. – usumoio Oct 05 '12 at 17:34
  • i am using the exact code that guy is providing there, but it gives only the time of that process's creation, i am trying this : print $time - date('h:m:s'); as his code returns the $time as the time of that process's creation, shall i paste the full code here or what? – aslam shafique Oct 05 '12 at 17:36
  • what does $pData from the guys code return? A timestamp? If so, compare it with time(). And see the linked dupe. – Gordon Oct 05 '12 at 17:37
  • that question is related to something else, i just need to compare two different times and get the difference in hours minutes or even seconds :) – aslam shafique Oct 05 '12 at 17:37
  • that is exactly what the linked dupe explains. there is a couple more questions about how to get time differences which you can easily find by searching (which is what you are supposed to do before asking questions). – Gordon Oct 05 '12 at 17:40
  • $pDate is returning something like this: 20121005170307 – aslam shafique Oct 05 '12 at 17:42
  • But how is this 20121005170307 converted to the correct time? – aslam shafique Oct 05 '12 at 17:43

1 Answers1

0

Use something like this

$msc=microtime(true);
$mysql_query($sql);
// or any process
$msc=microtime(true)-$msc;
StaticVariable
  • 5,253
  • 4
  • 23
  • 45