0

I have a review table where customers post a review. On posting, the data will be stored to database with the current date and time (timestamp). Also i have a field with a turn around time(TAT) (for eg: 48 hrs). Here my TAT is 48hrs from the time of posting.. I want to display the time remaining in hours and minutes based on current time. How can this be achieved..

Snm
  • 435
  • 4
  • 15

2 Answers2

0

First you need the timespan between those two dates.

$timespan = time() - $row['datetime'];

Then you need to convert to seconds to a time format, for example HH:MM

Here are some examples:

PHP - Convert seconds to Hour:Minute:Second

Convert seconds into days, hours, minutes and seconds

How to convert seconds to time format?

Community
  • 1
  • 1
Pakspul
  • 648
  • 5
  • 17
0

just try to get date from database and proceed with the PHP function to pass it on. You have to make one function just like 'timebetween' and go ahead further with the process, Create function with the parameters starttime and endtime (bothdate need to be passon, in which you need to time difference) and then go ahead with your time difference logic. finally it will return to you your difference.

Keyur Mistry
  • 926
  • 6
  • 18