Saturday, October 28, 2017

Current Day in JavaScript

A very simple script that I wrote using JavaScript to display the current day based on the date of your computer.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.



Sample Program Output


Program Listing

<html>
<title> Current Date in JavaScript </title>
<body>
<style>
body {
 font-family:arial;
 font-size:50px;
 font-weight:bold;
 color:blue;
 background-color:lightgreen;
}
</style>
<br><br>
<script>
var months=new Array(13);
months[1]="January";
months[2]="February";
months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
months[11]="November";
months[12]="December";
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate();
var year=time.getYear();
if (year < 2000)    
year = year + 1900; 
document.write("Today is " + lmonth + " ");
document.write(date + ", " + year );
</script>
</body></html>

No comments:

Post a Comment