php: simple way to convert time into readable time

Joined
12 Feb 2006
Posts
17,633
Location
Surrey
can't seem to find a way to do this and i'm sure it must be really simple. i have googled a lot but i think i am googling the wrong phrase to get the results i am after.

i have lets say a comment system which records when the comment was posted and then adds 30 days and then records when the comment will expire and get removed.

now i want to work out how long until the comment expires and show this to the user, so i subtracted the expire time from the current time() leaving a number like 2710380.

how do i work out how much this number is in a readable time like 1 day 3 hours and 21 seconds? i'm hoping there is just a simple way like i do the following $timeLeft/60/60*24 to get days etc?

thanks
 
Back
Top Bottom