Freigeben über


Small Basic #5: Clocks and Calendars

Microsoft Small Basic has a few clock-related properties for the date, year, month, day of the week, hour, minute, second, and even millisecond. They are demonstrated in the following code by using the Clock class:

 TextWindow.WriteLine("Today is: " + Clock.Date + ".")
TextWindow.WriteLine("Today is: " + Clock.Month + "/" + Clock.Day + "/" + Clock.Year + ".")
TextWindow.WriteLine("The current time is: " + Clock.Time + ".")
TextWindow.WriteLine("The current time is: " + Clock.Hour + ":" + Clock.Minute + ":" + Clock.Second + ".")
TextWindow.WriteLine(Clock.ElapsedMilliseconds + " milliseconds have passed since the year 1900.")
TextWindow.WriteLine("The current millisecond is: " + Clock.Millisecond + ".")
TextWindow.WriteLine("The current day of the week is: " + Clock.Weekday + ".")