Home } Time and Date } Basic Date Display



Use this code snippet to display today's date on your Web page.

The JavaScript Source: Time and Date: Basic Date Display

Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Command-s). The script is yours!!!

    

Did you use this script?  Do you like this site?  Please link to us!

Add a comment, suggestion, or correction
[For questions about usage, consult the Notes tab above or visit the JavaScript forum. Do not include more than two (2) lines of code in your comments. If you have suggestions or corrections, you can submit them to us.]

    
   
       
[optional]
 
[optional]

   

Comments feed Comment Feed RSS 2.0

1. From: katie
changing the text
04/08/2009 21:29:40

is there anyway i can change the appearance of this clock?
i tried using my div tag
"<div id='js'></div>"
inside the javascript like i have when using this code on my website:

var d = new Date();
var time = d.getHours();
if (time < 12)
{
document.write("<div id='js'>Good Morning! It is now</div>");
}
else
{
document.write("<div id='js'>Good Day! It is now</div>");
}



but it doesn't seem to be working :( i wanted to put my click right after the text

Sign up for the JavaScript Weekly

internet.com Privacy Policy
We'll send this script to you!

(just click "Send it!" once!)

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs