View Full Version : Time of day outputs
CyberGuru
01-12-2001, 07:17 AM
I need a script that will display a different message depending on the time of day. Between midnight and noon, it should say "Good Morning", from noon til 6pm, it should say "Good Afternoon" and from 6pm until midnight, it should say "Good Evening.
Thanx~Matt
Jacob
01-12-2001, 08:28 AM
Here ya go:
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>
<SCRIPT LANGUAGE="Javascript">
<!--
{
helixtime = new Date()
hrstime = helixtime.getHours()
if (hrstime > 0 && hrstime <12){timemsg = "Good morning."}
if (hrstime > 12 && hrstime <18){timemsg = "Good afternoon."}
if (hrstime >18 && hrstime <24){timemsg = "Good evening."}
document.write(timemsg)
}
// -->
</SCRIPT>
[/code]
(I modified the script per your specifications)
------------------
Jacob A. Wheeler
Co-Founder / Web Engineer
Big Resources Network
jacob@bigresources.com
ICQ: 390147 (http://www.icq.com/390147)
[This message has been edited by Jacob (edited 01-12-2001).]
CyberGuru
01-13-2001, 02:49 AM
Thanks
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.