Its my first time using JavaScript I'm trying to make the utctime and localtime to appear, but its not showing what did I do wrong here?
http://i53.tinypic.com/358a22w.png My work

<HTML>
<head><title>Displaying Times and Dates</title></head>
<body>
<h1>Current Date and Time</h1>
<p>
<script language="JavaScript" type="text/javascript"> 
now = new Date(); 
localtime = now.toString();
 utctime = now.GMTString();
 document.Write ("<b>localtime</b>" + localtime + "</br>");
 document.Write("<b>utctime</b>" + utctime); 
 </script> 
</p>
</body>
</html>

Here's what it supposed to look like got it from the tutorial
http://i55.tinypic.com/wl4qar.png
http://i52.tinypic.com/1zyv7o9.png

I'm going to bed I hope tomorrow I get some answers.
Both this and the one I made didn't even show the current time

Recommended Answers

All 4 Replies

Member Avatar for stbuchok

JavaScript is case sensitive. It's document.write, not document.Write

Its not showing up!

I am using an updated browser(IE9,Chrome,Opera,& Maxtor) and OS windows7 I even did what the guy told me to do and still not showing up.

Member Avatar for stbuchok

No need to get frustrated, it could be that you are doing multiple things wrong (which you are). I only pointed out the one that jumped out at me right away, I didn't know you had 2 things wrong.

It is not GMTString(), it is toGMTString(). You might also want to make it so that any scripting errors show an error dialog.

<HTML>
<head><title>Displaying Times and Dates</title></head>
<body>
<h1>Current Date and Time</h1>
<p>
<script language="JavaScript" type="text/javascript">
now = new Date();
localtime = now.toString();
utctime = now.toGMTString();
document.write ("<b>localtime</b>" + localtime + "</br>");
document.write("<b>utctime</b>" + utctime);
</script>
</p>
</body>
</html>

Thank you from now on I'm using Dreamweaver CS.5 because it error check everything for and makes work much easier, it all started when I put your example into Dreamweaver and it work from there I was able to understand what I made a mistake on. I'm using Dreamweaver from now on.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.