<!doctype html>
<meta charset= "Utf-8";
<title> Date </ Title>
<script type= "text/javascript";
function Disdate () {
//
var now=new Date ();
var year = Now.getfullyear ();
var month = Now.getmonth () +1;
var date = Now.getdate ();
var hour = now.gethours ();
var minute = now.getminutes ();
var second = Now.getseconds ();
var ms = Now.getmilliseconds ();
var day = Now.getday ();
var strday= "";
Switch (day) {
Case 1:
strday= "Monday"; break;
Case 2:
strday= "Tuesday"; break;
Case 3:
strday= "Wednesday"; break;
Case 4:
strday= "Thursday"; break;
Case 5:
strday= "Friday"; break;
Case 6:
strday= "Saturday"; break;
Case 0:
strday= "Sunday"; break;
}
var nowstr=year+ "year" +month+ "month" +date+ "Day"
+hour+ "when" +minute+ "minute" +second+ "Seconds"
+ms+ "milliseconds" +strday;
//year plus 1
now.setfullyear (year+1);
var nextstr= now.tolocalestring ();
Alert ("The current time is:" +nowstr+ "\ n \ nthe one year later today:" +NEXTSTR);
}
</script>
<body>
<button value= "button" onclick= "Disdate ()" > button </button>
</body>
Get Current date