Two JavaScript gets the current system date and time
Quote:
/ / Define a Tick function to get the time of the system
Function Tick ()
{
Var Year, Month, Day, Hours, Minutes, Seconds, AP;
Var Intyear, IntMonth, INTDAY, INTHOURS, INTMINUTES, INTSECONDS
VAR TODAY;
Today = new date ();
Interedear = Today.GetyEar ();
INTMONTH = TODAY.GETMONTH () 1;
INTDAY = TODAY.GETDATE ();
INTHOURS = TODAY.GETHOURS ();
INTMINUTES = TODAY.GETMINUTES ();
INTSECONDS = Today.getSeconds ();
// Get the number of hours of the system time
IF (INTHOURS == 0)
{
Hours = INTHOURS ":";
AP = "early morning";
}
Else IF (INTHOURS <12)
{
Hours = INTHOURS ":";
AP = "morning";
}
Else IF (INTHOURS == 12)
{
Hours = INTHOURS ":";
AP = "noon";
}
Else
{
INTHOURS = INTHOURS-12;
Hours = INTHOURS ":";
AP = "afternoon";
}
// Get the score of the system time
IF (INTMINUTES <10)
{
Minutes = "0" INTMINUTES ":";
}
Else
Minutes = INTMINUTES ":";
/ / Get the number of seconds of the system time
IF (Intseconds <10)
SECONDS = "0" intSeconds ""
Else
SECONDS = INTSECONDS ""
TimeString = Year Month Day Hours Minutes Seconds AP;
Clock.innerhtml = TimeString;
/ / Perform a Tick function every 0.1 seconds
Window.SetTimeout ("Tick ()", 100);
}
Window.οnlοad = tick;
script>
Below this is called a function
Quote:
---------------------------------------- Cute Split Line ------ --------------------------------------------
Quote:
Var day = ""
VAR MONTH = ""
VAR ampm = "";
VAR ampmhour = "";
Var myweekday = "";
VAR Year = "";
MyDate = new date (); myweekday = mydate.getday ();
MyMonth = mydate.getMonth () 1;
Myday = mydate.getdate ();
MYYEAR = mydate.getyear ();
Year = (MyYear> 200)? Myyear: 1900 myyear;
IF (MyWeekDay == 0)
Weekday = "Sunday";
Else IF (MyWeekDay == 1)
Weekday = "Monday";
Else IF (MyWeekDay == 2)
Weekday = "Tuesday";
Else if (MyWeekDay == 3)
Weekday = "Wednesday";
Else IF (MyWeekDay == 4)
Weekday = "Thursday";
Else IF (MyWeekDay == 5)
Weekday = "Friday";
Else IF (MyWeekDay == 6)
Weekday = "Saturday";
Document.write (" Beijing time" year "year" mymonth "month" myday "day" weekday " font>");
Script>