-2

I want to get minutes between now and future time, please help me!

$time = now - future time  

echo minutes
user3185208
  • 47
  • 1
  • 1
  • 7
  • 2
    We are sorry, we do not have telepathic abilities and are not able to read the minds of others. Try to explain in more details what you want from us. – Cheery Oct 09 '14 at 07:03
  • If you want the difference in minutes between two dates, please take a look at this: http://stackoverflow.com/questions/365191/how-to-get-time-difference-in-minutes-in-php – bruchowski Oct 09 '14 at 07:07
  • i want to get time like this structure: now minus other datetime – user3185208 Oct 09 '14 at 07:11

2 Answers2

0

I think you are looking for this:

date('Y-m-d H:i:s')

Check this link for more information http://pl.php.net/manual/en/function.date.php

If you are looking for the Datetime class check out this link: http://php.net/manual/en/class.datetime.php

If you want the diffrence between times you'll need this:

$to_time = strtotime("2008-12-13 10:42:00");
$from_time = strtotime("2008-12-13 10:21:00");
echo round(abs($to_time - $from_time) / 60,2). " minute";
The_Monster
  • 494
  • 2
  • 7
  • 28
0

You can use DateTime class to get desired result

$now = new DateTime();
$date = new DateTime("2014-10-20 12:13:29");

//calculate the difference between two dates
$diff = $now->diff($date);

//caculate number of minutes between two dates
$minutes = $diff->days * 24 * 60;
$minutes += $diff->h * 60;
$minutes += $diff->i;

// display difference in minutes
echo $minutes.' minutes';
krishna
  • 4,069
  • 2
  • 29
  • 56