Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Greet according to the time. Set default as afternoon.
<h1 class="gradient-text">
<span>Good afternoon.</span><br>
How can we help you today?
</h1>
var date = new Date();
if (date.getHours() < 12) {
$('.gradient-text span').html('Good Morning')
}
if (date.getHours() >= 18) {
$('.gradient-text span').html('Good Evening.')
}
if (date.getHours() >= 23) {
$('.gradient-text span').html('Good Evening.')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment