<Script language = "JavaScript">
Var myDate = new Date ();
MyDate. getYear (); // obtain the current year (2 digits)
MyDate. getFullYear (); // obtain the complete year (4 bits, 1970 -????)
MyDate. getMonth (); // obtain the current month (0-11, 0 represents January)
MyDate. getDate (); // obtain the current day (1-31)
MyDate. getDay (); // obtain X of the current week (0-6, 0 indicates Sunday)
MyDate. getTime (); // obtain the current time (milliseconds starting from 1970.1.1)
MyDate. getHours (); // obtain the current hour (0-23)
MyDate. getMinutes (); // obtain the current number of minutes (0-59)
MyDate. getSeconds (); // obtain the current number of seconds (0-59)
MyDate. getMilliseconds (); // obtain the current number of milliseconds (0-999)
MyDate. toLocaleDateString (); // obtain the current date
Var mytime = myDate. toLocaleTimeString (); // obtain the current time
MyDate. toLocaleString (); // obtain the date and time
If (mytime <"23:30:00 ")
{
Alert (mytime );
}
</SCRIPT>
2.
<%
Java. text. SimpleDateFormat formatter = new java. text. SimpleDateFormat ("yyyy-MM-dd HH: mm: ss ");
Java. util. Date currentTime = new java. util. Date (); // obtain the current system time
String str_date1 = formatter. format (currentTime); // format the date and time.
String str_date2 = currentTime. toString (); // converts a Date to a String.
%>