Display current Date in JavaScript

Is a dynamic computer programming language.[5] It is most commonly used as part of web browsers, whose implementations allow client-side scripts to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed.[5] It is also used in server-side network programming with runtime environments such as Node.js, game development and the creation of desktop and mobile applications.
Post Reply
dzcadii
Posts: 94
Joined: Sun Mar 01, 2015 4:36 am

Display current Date in JavaScript

Post by dzcadii » Sun Mar 01, 2015 11:01 pm

place this in the <head> tag of the html document

Code: Select all

<html><head>
<title>Just the date</title>
<script language="JavaScript" type="text/javascript">
//--------------- LOCALIZEABLE GLOBALS ---------------
var d=new Date();
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
//---------------   END LOCALIZEABLE   ---------------
</script>
</head>
and place this where you want the date to show up

Code: Select all

<script language="JavaScript" type="text/javascript">document.write(TODAY);</script>

Post Reply