View Full Version : dispaying times and dates help

05-10-2009, 11:59 AM
hi i dont know what is wrong with this code and why it is not working could someone please help me and tell me what i am doing wrong and what i need to do! thankyou

<head><title>Displaying dates and times</title></head>
<h1>Current Date and Time</h1>
<script language="JavaScript">
localtime= now.toString();
utctime= now.toGMTString();
document.write("<b>Local time:</b> " + localtime + "<BR>");
document.write("<b>UTC time:</b> " + + "</p>");
hours= now.getHours();
mins= now.getMinutes();
document.write("<font size='+5'>");
document.write(hours+ ":" + mins +":" + secs);

Philip M
05-10-2009, 12:31 PM
Sounds like homework!

now is undefined
secs is undefined
document.write("<b>UTC time:</b> " + + "</p>"); // work out for yourself what is wrong here
doucment.write("</font>); spelling and missing closing "

<script language="JavaScript"> is deprecated and obsolete. Use <script type = "text/javascript"> instead.

Quizmaster: What was the principal language spoken by the ancient Romans?
Contestant: Greek

05-10-2009, 02:24 PM
Come on. Either you changed your nick because after starting three threads about that exact same homework assignment code you didn't get the help you expected, or you just happen to take the same course as the other guy and posted at the wrong time in the wrong place.

Be that as it may, what you are doing is against the rules and you won't get any help here (at least not from me).