TimeDate

A TimeDate component monitors the system time and date; also, it can change the system time and date.

TimeDate Properties

Standard Properties:
class, parent, proto, version.

systemClock long
This read-only property is a count of the number of milliseconds since the system last rebooted; it "wraps around" about once every 49 hours. It is useful for conducting timing tests.

timeInterest integer (0-60)
This property determines how often the component will generate a _timeChanged() event.
If this property is zero, then no such events will be generated.
If this property is greater than zero, then a _timeChanged() event will be generated at midnight and every timeInterest minutes later. Thus, if timeInterest is one, then _timeChanged() events will occur every minute; if timeInterest is sixty, then _timeChanged() events will occur every hour.

TimeDate Events

_dateChanged()

_dateChanged( self AS timedate )

This event is generated whenever the date changes; either the system date has been changed or time has passed.

Pass:

self timedate
The component experiencing the event.

_timeChanged()

_timeChanged( self AS timedate )

This event is generated whenever the time changes; either the system time has somehow been reset, or else an event generated thanks to the timeInterest.

Pass:

self timedate
The component experiencing the event.

TimeDate Actions

GetDate()

GetDate( ) AS STRUCT Date

This action returns the current date. The returned structure has the following fields:

STRUCT Date
DIM year AS integer
DIM month AS integer REM 1 = January ... 12 = December
DIM day AS integer
END STRUCT

GetDayOfWeek()

GetDayOfWeek( year AS integer, month AS integer, day AS integer ) AS integer

This action returns the day of the week for a given day of the month in a given year. A return value of 1 means Sunday, 2 means Monday, ... and 7 means Saturday.

Pass:

year integer (1901-2099)
The year.

month integer (1-12)
The month. 1 means January, 2 means February, ... 12 means December.

day integer (1-31)
The day of month.

GetDaysInMonth()

GetDaysInMonth( year AS integer, month AS integer )

This action computes the number of days in a month in a given year.

Pass:

year integer (1901-2099)
The year. (This is necessary for computing the length of February in leap year.)

month integer (1-12)
The month. 1 means January, 2 means February, ... 12 means December.

GetTime()

GetTime ( ) AS STRUCT TimeOfDay

This action returns the current time. The returned structure has the following fields:

STRUCT TimeOfDay
DIM hour AS integer REM 0 - 23
DIM minute AS integer
DIM second AS integer
END STRUCT

SetDate()

SetDate( newDate AS STRUCT Date )

This action sets the current date. The passed structure has the following fields:

STRUCT Date
DIM year AS integer
DIM month AS integer REM 1 = January ... 12 = December
DIM day AS integer
END STRUCT

SetTime()

SetTime ( newTime AS STRUCT TimeOfDay )

This action sets the current time. The passed structure has the following fields:

STRUCT TimeOfDay
DIM hour AS integer REM 0 - 23
DIM minute AS integer
DIM second AS integer
END STRUCT