Calculate number of days remaining [duplicate]
问题 This question already has answers here : Finding the number of days between two dates (30 answers) Closed last month . I would like to calculate the number of days remaining before a date. In my database I have a timestamp corresponding to the end date. For example Friday 30. I would like to say something like that : 7 days remaining... 6, 5, 4, etc Can you help me please ? 回答1: $future = strtotime('21 July 2012'); //Future date. $timefromdb = //source time $timeleft = $future-$timefromdb;