Html 5 code

Hi,

I cannot get this script to show the date and time. Tried IE, Safari and Chrome. What is wrong?

Trying the learn Javascript with html and this is the first exercise!

Need help.

Regards

Chris

<!DOCTYPE html>

<html lang=“en”>
	<head>
		<title>Displaying Time and Dates</title>
	</head>

	<body>
		<h1>Current Date and Time</h1>
	<script type=“text/javascript”>
	now = new Date();
	localtime = now.toString();
	utctime = now.toGMTString();
	document.write(“<p><strong>Local time:</string> “ + localtime + “</p>”);
	document.write(“<p><strong>UTC time:</strong> “ utctime + “</p>”);
	</script>
	</body>
</html>

Open in new window

CMChalcraftFinance DirectorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark BullockQA EngineerCommented:
I changed your smart quotes (probably from Word) to normal quotes.
I fixed the first closing tag for strong.
And this displays the date and time.
<!DOCTYPE html>

 <html lang="en">
       <head>
             <title>Displaying Time and Dates</title>
       </head>

       <body>
             <h1>Current Date and Time</h1>
       <script type="text/javascript">
       now = new Date();
       localtime = now.toString();
       utctime = now.toGMTString();
       document.write("<p><strong>Local time:</strong> "+ localtime + "</p>");
       document.write("<p><strong>UTC time:</strong> " + utctime + "</p>");
       </script>
       </body>
 </html> 

Open in new window

0
CMChalcraftFinance DirectorAuthor Commented:
Hi,

Thanks for that. Amazing what you miss. String for Strong! I will try and look out for the normal quotes in the future.

I started using Pages for the html coding as I prefer using the Mac to Windows. I then found TextEdit on the Mac which I used for this. However I wonder now if I should just use Notepad.

Anyway it works. So onto the next scripting lesson.

Regards

Chris
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
CMChalcraft, did you mean to give Mark the points for this?  

Also, a very good text editor for mac http://www.barebones.com/products/textwrangler/ (free)  http://brackets.io/ (free)  https://www.jetbrains.com/webstorm/
0
CMChalcraftFinance DirectorAuthor Commented:
Very quick response.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.