TimeSpan

Represents a duration of time.

xxml
Language::Time

Methods

MethodParametersReturnsDescription
Constructordays: Integer^, hours: Integer^, mins: Integer^, secs: Integer^TimeSpan^From components
daysInteger^Days component
hoursInteger^Hours component
minutesInteger^Minutes component
secondsInteger^Seconds component
totalDaysDouble^Total as days
totalHoursDouble^Total as hours
totalMinutesDouble^Total as minutes
totalSecondsDouble^Total as seconds
totalMillisecondsDouble^Total as milliseconds
addother: TimeSpan^TimeSpan^Add durations
subtractother: TimeSpan^TimeSpan^Subtract durations
toStringString^d.hh:mm:ss format

Static

MethodParametersReturnsDescription
fromDaysdays: Integer^TimeSpan^Create from days
fromHourshours: Integer^TimeSpan^Create from hours
fromMinutesminutes: Integer^TimeSpan^Create from minutes
fromSecondsseconds: Integer^TimeSpan^Create from seconds
fromMillisecondsms: Integer^TimeSpan^Create from milliseconds

Examples

TimeSpan Usage

xxml
Instantiate Time::TimeSpan^ As <duration> = Time::TimeSpan::fromHours(Integer::Constructor(2));
Instantiate Time::TimeSpan^ As <extra> = Time::TimeSpan::fromMinutes(Integer::Constructor(30));
Instantiate Time::TimeSpan^ As <total> = duration.add(extra);

Run Console::printLine(total.toString());  // 0.02:30:00

See Also