PHP program to greet the user based on time

In this program, you will be welcoming users based upon a time if time is less than 12 pm you will print good morning, between 12 pm to 5 pm print good afternoon, between 5 pm to 8 pm good evening, and greater than 8 pm print good night

<?php 
$dat = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$date=$dat->format('H');
if($date < 12) 
  echo "Good morning to everyone"; 
else if($date < 17) 
  echo "Good afternoon to everyone";
else if($date<20)
  echo "Good evening to everyone"; 
else 
  echo "Good night to everyone"; 
?>

output

Good night to everyone