-3

I am using PHP and mysql to currently work on a project and I want to be able to automatically get the difference in time between the stored date and the current date, it can be in days,hours and minutes depending on the duration I want. So please I need a good suggestion on the best way to do this, either it be javascript or even a PHP function.

  • what type and timezone is your stored datetime in? do you really mean current date, not current time? – ysth May 26 '23 at 01:49

1 Answers1

0

What about php diff date function ?

<?php
$date1=date_create("2013-03-15");
$date2=date_create("2013-12-12");
$diff=date_diff($date1,$date2);
?> 

You can also check at this answer How to calculate the difference between two dates using PHP?

Porzio Jonathan
  • 536
  • 2
  • 13