You can achieve this with some simple JavaScript. Here's an example that you can paste into a Code Block on your page and then adjust to match your requirements.
<h2 id="greetingEl"><h2>
<script>
const time = new Date().getHours();
let greeting;
if (time < 12) {
greeting = "Good morning";
} else if (time < 19) {
greeting = "Good afternoon";
} else {
greeting = "Good evening";
}
document.getElementById("greetingEl").innerHTML = greeting;
</script>
The first section creates a heading element where the greeting will appear.
Below this is the script, which gets the time and then extracts the hour from this using the getHours() method. This returns an hour from 0 to 23 and this is used to determine which greeting to show. For a deeper explanation of this, see JavaScript if else and else if.
If this post has helped you, please click a 'Like' or 'Thanks' icon below ⬇️