Day time date.

Hello,I was wondering if anyone could tell me a code that would display the current date/time. I don't know if this is possible in HTML and I'm new to website building so any help would be appreciated.<br />
<br />
<br />
mike<!--content-->It can be done with a simple java script<br />
<br />
<b>Todays Date: </b><SCRIPT LANGUAGE="JavaScript" type="text/javascript"><br />
<!--<br />
Stamp = new Date();<br />
document.write('' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate()+ "/"+Stamp.getYear() + ' <br> ');<br />
var Hours;<br />
var Mins;<br />
var Time;<br />
Hours = Stamp.getHours();<br />
if (Hours >= 12) {<br />
Time = " P.M.";<br />
}<br />
else {<br />
Time = " A.M.";<br />
}<br />
<br />
if (Hours > 12) {<br />
Hours -= 12;<br />
}<br />
<br />
if (Hours == 0) {<br />
Hours = 12;<br />
}<br />
<br />
Mins = Stamp.getMinutes();<br />
<br />
if (Mins < 10) {<br />
Mins = "0" + Mins;<br />
}<br />
<br />
document.write('<B>Todays Time:</b> ' + Hours + ":" + Mins + Time + '');<br />
<br />
//--><br />
</SCRIPT><br />
<br />
It only took me a second to find this on google...<!--content-->It should, however, use getFullYear(), as getYear() will return 103... ;)<!--content-->You can really shorten that, and make it more user friendly, by using...<br />
<br />
<script type="text/javascript"><br />
<!--<br />
document.write('<p>', new Date().toLocaleString(), '</p>');<br />
// --><br />
</script><!--content-->Heh I did not write it I just wanted to find it on google so I could say to people this only took my 2.3 minuits to find on google, lol. I would rather people find snippets themselves instead of having one of us write them a script or dig it up when it is a simple thing like this and it is not something like how would I go about doing this or do you have an idea or suggestion type of question.<!--content-->You could just post this link:<br />
<br />
<!-- m --><a class="postlink" href="http://www.google.com/search?q=learn+to+search+google">http://www.google.com/search?q=learn+to+search+google</a><!-- m --> :D<!--content-->HAHA that is a good one! I will need to use that sometime.<!--content-->Well actually I did search google,but I typed I was searching for the HTML code that did that. Sorry for the noob post ,but there's no need to flame me. Anyway, I have a question. HOw could I take that code and have it update the minute when the time changes other than the whole page refreshing.<br />
<br />
<br />
thanks for your help.<br />
<br />
mike<!--content--><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"<br />
"http://www.w3.org/TR/html4/strict.dtd"><br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
<meta name="Content-Script-Type" content="text/javascript"><br />
<title>Example</title><br />
<br />
<script type="text/javascript"><br />
<!--<br />
if (document.getElementById) onload = function () {setInterval("document.getElementById('date-time').firstChild.data = new Date().toLocaleString()", 250)}<br />
<br />
document.write('<p>It is now <span id="date-time">', new Date().toLocaleString(), '</span></p>');<br />
// --><br />
</script><!--content-->Originally posted by Mike35 <br />
but there's no need to flame me We were not flaming you. But I like to point it out when something is easy to find. If I were flaming you I would use some of my really good insult pics (most are too dirty and mean for this forum) and since the image code on this forum is disabled I would use a link to them :) ... I don't flame people on this forum.<!--content--><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" <br />
"http://www.w3.org/TR/html4/strict.dtd"> <br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <br />
<meta name="Content-Script-Type" content="text/javascript"> <br />
<title>Example</title> <br />
<br />
<script type="text/javascript"> <br />
<!-- <br />
if (document.getElementById) onload = function () {setInterval("document.getElementById('date-time').firstChild.data = new Date().toLocaleString()", 250)} <br />
<br />
document.write('<p>It is now <span id="date-time">', new Date().toLocaleString(), '</span></p>'); <br />
// --> <br />
</script><br />
<br />
<br />
Ahh charles your a life saver.<br />
<br />
<br />
mike<!--content-->
 
Back
Top