[X]

Greeting By Time Of Day

time and date 1997 still works

Says good morning, good afternoon or good evening depending on the visitor's clock.

In 2026: Works unchanged.

Where it came from: Netscape JavaScript examples, 1996. MDN

<script language="JavaScript">
var h = new Date().getHours();
var greet;
if (h < 5)       greet = "You're up late";
else if (h < 12) greet = "Good morning";
else if (h < 18) greet = "Good afternoon";
else             greet = "Good evening";
document.write("<h2>" + greet + ", and welcome to my page!</h2>");
</script>
sandboxed demo · breaks nothing but itselfrestart

More in time and date

all 6 in time and date › · the whole library ›