JavaScript gets the current date time and displays the day of the week, with the specific code as follows:
Dynamically display the current date and time on a Web page and display the week's practice:
function ShowTime () {
var show_day=new Array (' Monday ', ' Tuesday ', ' Wednesday ', ' Thursday ', ' Friday ', ' Saturday ', ' Sunday ');
var time=new Date ();
var year=time.getyear ();
var month=time.getmonth ();
var date=time.getdate ();
var day=time.getday ();
var hour=time.gethours ();
var minutes=time.getminutes ();
var second=time.getseconds ();
Month<10?month= ' 0 ' +month:month;
month=month+1;
Hour<10?hour= ' 0 ' +hour:hour;
minutes<10?minutes= ' 0 ' +minutes:minutes;
Second<10?second= ' 0 ' +second:second;
var now_time= ' current time: ' +year+ ' year ' +month+ ' month ' +date+ ' Day ' + ' ' +show_day[day-1]+ ' ' +hour+ ': ' +minutes+ ': ' +second;
document.getElementById (' Showtime '). Innerhtml=now_time;
SetTimeout ("ShowTime ();", 1000);
On this aspect of the content of the Internet, there are JS to get the current date and time at the same time, JS to obtain the current time and a week of time and other content, are very valuable reference, I hope that we read more similar articles, will be familiar with similar methods.