TimeSpan
Represents a duration of time.
xxml
Language::TimeMethods
| Method | Parameters | Returns | Description |
|---|---|---|---|
| Constructor | days: Integer^, hours: Integer^, mins: Integer^, secs: Integer^ | TimeSpan^ | From components |
| days | — | Integer^ | Days component |
| hours | — | Integer^ | Hours component |
| minutes | — | Integer^ | Minutes component |
| seconds | — | Integer^ | Seconds component |
| totalDays | — | Double^ | Total as days |
| totalHours | — | Double^ | Total as hours |
| totalMinutes | — | Double^ | Total as minutes |
| totalSeconds | — | Double^ | Total as seconds |
| totalMilliseconds | — | Double^ | Total as milliseconds |
| add | other: TimeSpan^ | TimeSpan^ | Add durations |
| subtract | other: TimeSpan^ | TimeSpan^ | Subtract durations |
| toString | — | String^ | d.hh:mm:ss format |
Static
| Method | Parameters | Returns | Description |
|---|---|---|---|
| fromDays | days: Integer^ | TimeSpan^ | Create from days |
| fromHours | hours: Integer^ | TimeSpan^ | Create from hours |
| fromMinutes | minutes: Integer^ | TimeSpan^ | Create from minutes |
| fromSeconds | seconds: Integer^ | TimeSpan^ | Create from seconds |
| fromMilliseconds | ms: 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