<?php $start = strtotime('02:00:00'); $end = strtotime('16:00:00'); //$now = strtotime(date("H:i:s")); $now = strtotime('08:00:00'); if($start < $end){ // regular day if($now > $start && $now < $end){ echo "Gece"; }else{ echo "Gunduz"; } }else{ // rotate day if($now > $start || $now < $end){ // early night echo "Gece"; }else{ echo "Gunduz"; } } ?>