Automatically Display the Current or Today's Date with JavaScript
Add the following code to your html page where you want today's date to be displayed automatically
<script>
<!-- //Hide From Old Browsers
/*
Do Not Remove the Following Line
For more scripts visit http://www.w3courses.com
*/
var d=new Date();
var y=d.getYear();
if (y < 1000)
y+=1900;
var day=d.getDay();
var m=d.getMonth();
var daym=d.getDate();
if (daym<10)
daym="0"+daym;
var mon=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
document.write("<font size='2' color='red'>"+mon[m]+" "+daym+", "+y+"</font>");
// End Hide -->
</script>
Related Articles
- Validate a Check Box Using JavaScript
- Automatic Redirect using Javascript
- Multi Level Drop Down Category & Subcategory Hierarcheal Selection using JavaScript
- Flash and JavaScript Conflict: Javascript Menu goes behind the flash file
- Display Current Date Automatically on your Website using JavaScript
- How to Create a Reload Button which will Reload the Webpage upon Clicking using JavaScript
- Automatically Redirect from one Webpage to Another Webpage using JavaScript
- How to Display a Webpage in the PopUp Window after Clicking from a Link using JavaScript
