Click to See Complete Forum and Search --> : getDay, getTime


N O 0 B Y
01-01-2004, 11:52 AM
Oh No! I forgot how to get a time and display it on my site!
Please tell me someone.:confused::(

fredmv
01-01-2004, 11:55 AM
Welcome to the forums.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>untitled</title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" />
<script type="text/javascript">
//<![CDATA[
onload = function()
{
setInterval
(
function()
{
document.getElementById('time').innerHTML = (new Date()).toLocaleString();
},
1000
);
}
//]]>
</script>
</head>
<body>
<div id="time"></div>
</body>
</html>

N O 0 B Y
01-01-2004, 12:01 PM
thanks for the code but i thought i saw a simpler one somewhere. I want to post something like 'good morning' if the time is between 7:00 am and 11:00 am. and stuff like that.