Question

Good morning, guys. I was just thinking about the small PHP crawler, that could browse my 2 favourite websites and show me some info about auctions from 1 category. I haven't started to write anything, because I stuck on the remaining time that every auction has. I want to snow only the date, when the auction ends. But these sites provide me only a seconds (or miliseconds), that remains from now to the end. How to convert these seconds into normal date like 2011-08-24? I appreciate any advice.

George

Was it helpful?

Solution

Just do $date = time() + $seconds;. Now $date holds the date on which the auction will end. You can output that in a nice way with date().

OTHER TIPS

//watch for time zone issues
echo date('l jS \of F Y h:i:s A',time()+$remaining);

+ not - sorry
echo date('Y-m-d',time() - $remaining_seconds);

This will format your date as YYYY-MM-DD as you requested.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top