I am doing a mini countdown type thing but i have hit a snag.
What i am first trying to do is get the time 7 days from now and then(later insert into database but not now) work out the difference between the current date and the date that was said to be in 7 days, even though it will be eg 4 days 5 hours from that date.
What i have so far is
<?php $when = 'now'; $nextWeek = date('Y-m-d H:i:s',strtotime("$when +7 days 4 hours 2 seconds")); echo $nextWeek; //test data //$nextWeek = time()+86400*7; //echo date("Y-m-d H:i:s", $nextWeek); $iStartDate = 'now'; $iEndDate = $nextWeek; printf ( 'Distance between 2 dates is %d days.', (strtotime($iEndDate) - strtotime($iStartDate)) / 86400 ); ?>
The problem now is that it will only pull out the amount of days, but i would also like the hours and minutes to show.
Can anyone help me please. This would very much be appreciated.