setTime

setTime(hours:        Integer;
        minutes:      Integer;
        seconds:      Integer;
        milliseconds: Integer): Boolean updating;

The setTime method of the Time primitive type sets the value of the receiver to a specified time in 24-hour clock form using any valid combination of parameters. This method returns true if the specified time is valid or it returns false if it is invalid (for example, 24:00).

The parameters are integer values for hours, minutes, seconds, and milliseconds.

The code fragments in the following examples show the use of the setTime method.

startTime.setTime(startH.Integer, startM.Integer, 0, 0);
endTime.setTime(endH.Integer, endM.Integer, 0, 0);

if stopWatchButton.caption = "Stop Watch" then
    endTimer(1);
    stopWatchButton.caption := "Start";
    app.doWindowEvents (1);
    clockFrame.caption := "00:00:00";
    displayedTime.setTime(0, 0, 0, 0);
elseif ...  then
    ...
endif;

You can use this method to set a valid time less than 24 hours in milliseconds. For example, the following code fragment sets the time to twelve hours in milliseconds.

startTime.setTime(0, 720, 0, 0);