Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Time

The Time class represents an immutable duration or time-of-day value, expressed in hours, minutes, and seconds. Time is automatically available in scripts — no import is needed to construct one.

Fields

FieldTypeDescription
hoursintegerRead only. The hours component.
minutesintegerRead only. The minutes component, from 0 to 59.
secondsintegerRead only. The seconds component, from 0 to 59.
totalSecondsintegerRead only. The total value expressed in seconds.

Constructors

init( )

Constructs a zero-valued Time (zero duration / midnight).

init( hours )

Constructs a Time from a floating-point hours value. For example, Time(8.5) represents 8 hours and 30 minutes.

init( hours, minutes, seconds )

Constructs a Time from integer hours, minutes, and seconds components. For example, Time(8, 0, 0) represents 8 hours.