-2

How can i get the number of days back when the subscription exipires?

I have "vipudlob" in my database. and it's timestamp ex. 2 month forward.?

<?php
$expire = strtotime("+2 months", time());
$daysback = $expire-time();
echo $daysback%3600;
?>

1 Answers1

0

You can try

$datetime1 = new DateTime();
$datetime2 = new DateTime("+2 months");
$interval = $datetime1->diff($datetime2);
echo $interval->format('%R%a days');

Output

+61 days
Baba
  • 94,024
  • 28
  • 166
  • 217