Posts Tagged ‘mintues’
How do I show the difference between two dates and times in php?
How do I show the difference between two timestamps (which both show the date and time) in php? I have a formula that shows the difference between 2 timestamps, but the format that it shows the difference in is in days/ hours/ minutes/ seconds. I only want one unit to appear. For instance:
If it has been less than a minute between those two dates, I want to return the number of seconds between those dates.
If it’s been less than an hour between the dates, return the number of mintues between the dates.
If less than a day, return the number of hours.
I had more, but if I get those or at least a few of those, I can figure out the rest. Thanks.
I am still accepting solutions. Answer 1 is not acceptable. Please don’t post links unless it is a link to an actual solution.