Skip to content

Class Clock

Kristian Virtanen edited this page Oct 14, 2024 · 11 revisions

Description:

The Clock class provides access to the system's date and time, offering properties to retrieve current time, date, and related information in different formats. It uses the system clock to return values since January 1, 1900.

Example codes:

Methods:

  • Clock.Time

  • Gets the current system time.

  • Clock.Date

  • Gets the current system date.

  • Clock.Year

  • Gets the current year.

  • Clock.Month

  • Gets the current Month.

  • Clock.Day

  • Gets the current day of the month.

  • Clock.WeekDay

  • Gets the current day of the week.

  • Clock.Hour

  • Gets the current Hour.

  • Clock.Minute

  • Gets the current Minute.

  • Clock.Second

  • Gets the current Second.

  • Clock.Millisecond

  • Gets the current Millisecond.

  • Clock.ElapsedMilliseconds

  • Gets the number of milliseconds that have elapsed since 1900.

Top

Example code in SmallBasicOE:

TextWindow.WriteLine(SB.Clock.Time)
TextWindow.WriteLine(SB.Clock.Date)
TextWindow.WriteLine(SB.Clock.Time)
TextWindow.WriteLine(SB.Clock.Year)
TextWindow.WriteLine(SB.Clock.Month)
TextWindow.WriteLine(SB.Clock.Day)
TextWindow.WriteLine(SB.Clock.WeekDay)
TextWindow.WriteLine(SB.Clock.Hour)
TextWindow.WriteLine(SB.Clock.Minute)
TextWindow.WriteLine(SB.Clock.Second)
TextWindow.WriteLine(SB.Clock.Millisecond)
TextWindow.WriteLine(SB.Clock.ElapsedMilliseconds)

Top

Example code in C#:

// Create an alias for the SmallBasicOpenEditionDll namespace
using SB = SmallBasicOpenEditionDll;

static class SB_Program
{
    static void Main()
    {
        SB.TextWindow.WriteLine(SB.Clock.Time);
        SB.TextWindow.WriteLine(SB.Clock.Date);
        SB.TextWindow.WriteLine(SB.Clock.Time);
        SB.TextWindow.WriteLine(SB.Clock.Year);
        SB.TextWindow.WriteLine(SB.Clock.Month);
        SB.TextWindow.WriteLine(SB.Clock.Day);
        SB.TextWindow.WriteLine(SB.Clock.WeekDay);
        SB.TextWindow.WriteLine(SB.Clock.Hour);
        SB.TextWindow.WriteLine(SB.Clock.Minute);
        SB.TextWindow.WriteLine(SB.Clock.Second);
        SB.TextWindow.WriteLine(SB.Clock.Millisecond);
        SB.TextWindow.WriteLine(SB.Clock.ElapsedMilliseconds);
    }
}

Top

Clone this wiki locally