mforan Posted January 5, 2009 Share Posted January 5, 2009 ok so lets say, in my database is set a time in unix, in the future. lets say + 2 days from now. i want to display some output that would say: 2 days, 0 hours and 0 minutes remaining. obviously this would grab the current time() and compare it to the value in the database.... but how do i go about even making something that can do this? Quote Link to comment https://forums.phpfreaks.com/topic/139475-using-unix-time-to-determine-a-countdown/ Share on other sites More sharing options...
premiso Posted January 5, 2009 Share Posted January 5, 2009 <?php $newTime = time()+3600*24*2; // todays from now. $timeLeft = $newTime - time(); echo date('d', $timeLeft) . " days left"; ?> That probably will not get you the exact results but it is a start. You may want to look into strtotime also. Quote Link to comment https://forums.phpfreaks.com/topic/139475-using-unix-time-to-determine-a-countdown/#findComment-729610 Share on other sites More sharing options...
mforan Posted January 5, 2009 Author Share Posted January 5, 2009 Yer both values are going to have to be inputted through as unix thou. Since its like a que timer, I want ny users to know how long they have left to wait. I considered using java script here but it won't be nessasary reallly + its always better to use as little variations of coding type as possible. I've checked up on the google for some infos about php count down but none seem to use unix other than time() feature which is an obvious requirement since u are comparing whatever value to this. Is ther a way to convert time() to say something like Date(0,0,0,0,0) just with numbers? Quote Link to comment https://forums.phpfreaks.com/topic/139475-using-unix-time-to-determine-a-countdown/#findComment-729804 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.