0

my code works perfectly and I got the time difference but now I need to check whether the difference is less or more than a month old and I can't figure it out

following is my codes what else do I need to do

<?php if (time_ago($ticket->created) < 30) {
   $date = time_ago($ticket->created);

     echo '<div class="alert alert-danger" role="alert">
  This ticket is  '.$date.' old
</div>';
}
else {
  echo "ok";
}

 ?>

I checked with 30 but it does not work it shows a ticket which was lodged even less than a month ago

  • first it would be important to know what `time_ago($ticket->created)` returns – Alex Jun 09 '19 at 20:40
  • You need this [Converting timestamp to time ago in PHP e.g 1 day ago, 2 days ago…](https://stackoverflow.com/questions/1416697/converting-timestamp-to-time-ago-in-php-e-g-1-day-ago-2-days-ago) – M Ikram Zafar Jun 10 '19 at 07:49

0 Answers0