makeTime Function

Top  Previous  Next

Builds a time value from its components hour, minute, and second.

Syntax

DateTime.makeTime(hour, min [, sec])

Arguments

hourAn integer in the range 0 - 23 specifying the hour.
minAn integer in the range 0 - 59 specifying the minute.
secAn optional integer in the range 0 - 59 specifying the second; zero if omitted.

Return Value

If all arguments are valid, an integer that is the time value for the given time; otherwise, NaN (not a number).

Remarks

A time value is a date/time value with the date portion set to zero. This means that numerically it is the number of seconds after midnight.

Examples

DateTime.makeTime(15, 21)// 3:21:00 PM
DateTime.makeTime(2, 30, 61)// NaN - too many seconds
DateTime.makeTime(2, 31, 1)// 2:31:01 AM