If you can get the date stamp in a more useful format (a Unix timestamp, for example), that would take care of the bulk of your code straight off. Then you could just have
$when = strtotime('+24 hours', $str);
If you can't for some reason, the bulk of your code can still be got rid of:
list($y,$m,$d,$h,$i,$s) = sscanf($str, '%4d%2d%2d%2d%2d%2d');
$now = mktime($h,$i,$s,$m,$d,$y);
You can get $when the same way as before using $now, but since here you already have all the bits, you might as well take the easy route:
$when = mktime($h+24,$i,$s,$m,$d,$y);
(Here and before, note that 1 day is not necessarily 24 hours: decide what you actually mean and use that.)
Do $when - the current time to find out how many seconds there are to go, and from there on it's just the usual "divide by sixty and keep the remainder" business to convert that to minutes and seconds, and that to hours, minutes and seconds.