So I am currently trying to send a greeting in a heading in my page. It should say "Good Day", or "Good Evening", etc., if the time is </> but = to the users time/timezone. But when receiving the greeting, it doesn't show the right one I've set for smaller than, or greater than, according to my timezone. I am in Germany. And people are from everywhere. So is there a way to receive the right echo according to your timezone? And if so, I would like the echos to display, when the timezone of the visitor is = to the hours set.
<?php
$time = date("H");
if (time < "4") {echo '<h1 id="Welcm">Welcome, Good Night</h1>';}
else if (time < "12") {echo '<h1 id="Welcm">Welcome, Good Morning</h1>';}
else if (time > "12") {echo '<h1 id="Welcm">Welcome, Good Day</h1>';}
else if (time > "18") {echo '<h1 id="Welcm">Welcome, Good Evening</h1>';}
else if (time > "23") {echo '<h1 id="Welcm">Welcome, Good Night</h1>';}
else {echo '<h1 id="Welcm">Welcome, Good Day</h1>';}
?>
Sorry, didn't know which snippet I should pick for PHP as there is none for PHP.
So this works, like it should, but not in the right timezone. I want the right greeting to appear according to the timezone which is always visitor specific. Like the right one should appear for Amerika/New_York, but also for Germany/Berlin and so on. If this doesn't, the greeting is worth- and workless.