<SCRIPT type = "text/JavaScript">
// Gettime () indicates the number of seconds since January 1 ,.
VaR n = new date ();
VaR t = n. getfullyear ();
// Document. write ('my time: '+ N. getfullyear () + ''+ N. getmonth () + ''+ N. getdate () + ''+ N. getday () + ''' n. gethours () + ''+ N. getminutes () + ''+ N. getseconds ());
Document. Write ('<br> ');
Document. Write (t );
Document. Write ('<br> ');
Function printtime (SECs ){
VaR Sep = ':';
VaR hours, minutes, seconds, time;
VaR now = new date ();
Hours = now. gethours ();
If (hours <12 ){
Meridiem = 'am ';
} Else {
Meridiem = 'pm ';
}
Hours = hours % 12;
If (hours = 0 ){
Hours = 12;
}
Time = hours;
Minutes = now. getminutes ();
If (minutes <10) {// it cannot be changed to 10 !!!!!!!!!!!!!!!!!!!!!!!!
Minutes = '0' + minutes;
}
Time + = Sep + minutes;
If (SECs ){
Seconds = now. getseconds ();
If (seconds <10 ){
Seconds = '0' + seconds;
}
Time + = Sep + seconds;
}
Return time + ''+ meridiem;
}
// New date (), '% N/% d/% y'
Function datestring (date, string ){
VaR year = date. getfullyear ();
VaR month = date. getmonth ();
VaR realmonth = month + 1;
VaR fillmonth = realmonth;
If (realmonth <10 ){
Fillmonth = '0' + fillmonth;
}
VaR months = ['january ', 'february', 'march', '0000l', 'may', 'june', 'july', 'August ', 'September ', 'October ', 'november', 'december'];
VaR monthname = months [parseint (month, 10)-1];
VaR day = date. getdate ();
VaR filldate = Day;
If (day <10 ){
Filldate = '0' + Day;
}
VaR weekday = date. getday ();
VaR weekdays = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'Friday', 'saturday'];
VaR dayname = weekdays [weekday];
String = string. Replace (/% Y/g, year );
String = string. Replace (/% Y/g, year. tostring (). Slice (-2); // the last two digits of the year
String = string. Replace (/% M/G, monthname );
String = string. Replace (/% M/G, monthname. Slice (0, 3 ));
String = string. Replace (/% N/g, fillmonth );
String = string. Replace (/% N/g, realmonth );
String = string. Replace (/% W/g, dayname );
String = string. Replace (/% M/G, dayname. Slice (0, 3 ));
String = string. Replace (/% d/g, filldate );
String = string. Replace (/% d/g, Day );
Return string;
}
Document. Write ('<br> ');
Document. Write (printtime (true ));
Document. Write ('<br> ');
Document. Write (datestring (new date (), 'Today is % W, % m % d, % y '));
</SCRIPT>