The TIME function takes Numbers describing an hour, minute, second, and (optionally) millsecond; it uses these to create a Time, which it returns.

 This function requires three Numbers as input. It outputs a Time, with the given numbers used as the hour, minute, and second values. As an option, it also accepts a forth Number: the millisecond value in the time. By default, the millisecond value is 0. 

Declaration

TIME(hour, minute, second, millisecond) -> time

 

Parameters

hour (required, type: Number)
An integer between 0 and 23; this represents the hour in a 24-hour day. 
minute (required, type: Number)
An integer between 0 and 59; this represents the minute in a 60-minute hour. 
second (required, type: Number)
An integer between 0 and 59; this represents the second in a 60-second minute. 
millisecond (optional, type: Number, default: 0)
A number between 0 and 999; this represents the millisecond in a 1000-millisecond second.

Return Values

time (type: Time)
A Time with the hour, minute, second, and millisecond values specified by the given Numbers.

Examples

The following example returns the time 1:02AM and 3 seconds. Note that no input value is given specifying the number of milliseconds, and so the value of the millisecond within the returned Time is 0:

TIME(1, 2, 3) -> {
"hour": 1
"minute": 2
"second": 3
"millisecond": 0
}

In order for the TIME function to return a Time will more precision than a second, a forth Number must be given as input. The following example returns a time a half-second ahead of the above example:

TIME(1, 2, 3, 500) -> {
"hour": 1
"minute": 2
"second": 3
"millisecond": 500
}

 

Was this article helpful?

0 out of 0 found this helpful