var tanggal = new Date();
var ucap= tanggal.getHours();
if (ucap>=00)
{
if (ucap < 10) 
document.write ("Selamat pagi");
}    
if(ucap >=10)
{
if (ucap <15) 
document.write ("Selamat siang");
}
if(ucap >= 15) 
{                                    
if (ucap <18)
document.write ("Selamat sore");
}
if (ucap>=18) 
{
document.write ("Selamat malam");
}