проверьте этот код, надеюсь, он решит вашу проблему
<?php
$end = new DateTime('22:00');
$new_end = strtotime($end->format('Hi')); //convert to string
$end_h = idate('h', $new_end); //get the hour
$end_h = str_pad($end_h, 2, 0, STR_PAD_RIGHT);
$end_m = idate('i', $new_end);
$end_m = str_pad($end_m, 2, 0, STR_PAD_LEFT); //get leading zero for above minutes 10
$time_end = $end_h.''.$end_m;
$now = new DateTime();
$new_now = strtotime($now->format('Hi'));
$now_h = idate('h', $new_now);
$now_h = str_pad($now_h, 2, 0, STR_PAD_RIGHT);
$now_m = idate('i', $new_now);
$now_m = str_pad($now_m, 2, 0, STR_PAD_LEFT);
$time_now = $now_h.''.$now_m;
echo ($time_end - $time_now); //get the result do your logic after this code