Get a time, second, minute or hour

There are functions which you can use in your rules to get particular times, seconds, minutes or hours.

What do you want to do?

Get the current time

Get the second component of an input time

Get the minute component of an input time

Get the hour component of an input time

Get a time of day from another time of day

Get the current time

To insert the system time (at the start of the session) into a rule, you use the Current Date Time function and extract the time from it using the Extract Time of Day function.

For example, the following comparison:

the time of the assessment = ExtractTimeOfDay(the current date time)

will infer the time of the assessment to be 15:30:00 if the rule is run on 2008-12-12 at 15:30:00.

Get the second component of an input time

To extract the second component of an input time (ie from a time of day variable or a date time variable), you use the Extract Second function. For example:

the second component of the submission time = ExtractSecond(16:30:42)

will infer the second component of the submission time to be 42. Note that the input time can be a constant as in this example, or a variable, as in the example below:

the second component of the submission time = ExtractSecond(the submission time)

In all cases the value returned is a number.

Get the minute component of an input time

To extract the minute component of an input time (ie from a time of day variable or a date time variable), you use the Extract Minute function. For example:

the minute component of the submission time = ExtractMinute(16:30:42)

will infer the minute component of the submission time to be 30. Note that the input time can be a constant as in this example, or a variable, as in the example below:

the minute component of the submission time = ExtractSecond(the submission time)

In all cases the value returned is a number.

Get the hour component of an input time

To extract the hour component of an input time (ie from a time of day variable or a date time variable), you use the Extract Hour function. For example:

the hour component of the submission time = ExtractHour(16:30:42)

will infer the hour component of the submission time to be 16. Note that the input time can be a constant as in this example, or a variable, as in the example below:

the hour component of the submission time = ExtractHour(the submission time)

In all cases the value returned is a number.

Get a time of day from another time of day

To set the value of a time of day variable from another time of day, you use the Time Of Day function. For example:

the latest submission time = TimeOfDay(the time specified by the lecturer for submission)

will infer the latest submission time to be 17:00:00 if the time specified by the lecturer for submission is 17:00:00.

 

See also: