1. Technology

Use JavaScript to Display the Current Date

Example

See the code

This script will show the current date according to your computer. Note: if your computer time is off, this script will display the wrong time as well.

A completely unformatted version of the date is the default.
Today's date is:

With a few more lines you can get it to display the day of the week. Today is:

Or you can display just the date.

And with a few other lines, can you can greet your readers with the appropriate greeting.

Return to Article

Jennifer Kyrnin

©2014 About.com. All rights reserved.