Reference
Duration
From Milliseconds
| Input | A number representing the number of milliseconds. |
|---|---|
| Output | A duration instance representing the specified number of milliseconds. |
Signature
duration_fromMilliseconds(a: Number): DurationExample
duration_fromMilliseconds(5000) // returns a duration of 5000 millisecondsFrom Seconds
| Input | A number representing the number of seconds. |
|---|---|
| Output | A duration instance representing the specified number of seconds. |
Signature
duration_fromSeconds(a: Number): DurationExample
duration_fromSeconds(3600) // returns a duration of 3600 secondsFrom Minutes
| Input | A number representing the number of minutes. |
|---|---|
| Output | A duration instance representing the specified number of minutes. |
Signature
duration_fromMinutes(a: Number): DurationExample
duration_fromMinutes(90) // returns a duration of 90 minutesFrom Hours
| Input | A number representing the number of hours. |
|---|---|
| Output | A duration instance representing the specified number of hours. |
Signature
duration_fromHours(a: Number): DurationExample
duration_fromHours(24) // returns a duration of 24 hoursFrom Days
| Input | A number representing the number of days. |
|---|---|
| Output | A duration instance representing the specified number of days. |
Signature
duration_fromDays(a: Number): DurationExample
duration_fromDays(7) // returns a duration of 7 daysFrom
| Input | Five numbers representing days (a), hours (b), minutes (c), seconds (d), and milliseconds (e). |
|---|---|
| Output | A duration instance created from the specified components. |
Signature
duration_from(a: Number, b: Number, c: Number, d: Number, e: Number): DurationExample
duration_from(1, 2, 30, 0, 0) // returns a duration of 1 day, 2 hours, 30 minutesTo Milliseconds
| Input | A duration instance. |
|---|---|
| Output | The total duration converted to milliseconds. |
Signature
duration_toMilliseconds(a: Duration): NumberExample
duration_toMilliseconds(duration_fromSeconds(2)) // returns 2000To Seconds
| Input | A duration instance. |
|---|---|
| Output | The total duration converted to seconds. |
Signature
duration_toSeconds(a: Duration): NumberExample
duration_toSeconds(duration_fromMinutes(5)) // returns 300To Minutes
| Input | A duration instance. |
|---|---|
| Output | The total duration converted to minutes. |
Signature
duration_toMinutes(a: Duration): NumberExample
duration_toMinutes(duration_fromHours(2)) // returns 120To Hours
| Input | A duration instance. |
|---|---|
| Output | The total duration converted to hours. |
Signature
duration_toHours(a: Duration): NumberExample
duration_toHours(duration_fromDays(1)) // returns 24To Days
| Input | A duration instance. |
|---|---|
| Output | The total duration converted to days. |
Signature
duration_toDays(a: Duration): NumberExample
duration_toDays(duration_fromHours(48)) // returns 2Milliseconds
| Input | A duration instance. |
|---|---|
| Output | The milliseconds component of the duration (0-999). |
Signature
duration_milliseconds(a: Duration): NumberExample
duration_milliseconds(duration_from(0, 0, 0, 1, 500)) // returns 500Seconds
| Input | A duration instance. |
|---|---|
| Output | The seconds component of the duration (0-59). |
Signature
duration_seconds(a: Duration): NumberExample
duration_seconds(duration_from(0, 0, 1, 30, 0)) // returns 30Minutes
| Input | A duration instance. |
|---|---|
| Output | The minutes component of the duration (0-59). |
Signature
duration_minutes(a: Duration): NumberExample
duration_minutes(duration_from(0, 1, 45, 0, 0)) // returns 45Hours
| Input | A duration instance. |
|---|---|
| Output | The hours component of the duration (0-23). |
Signature
duration_hours(a: Duration): NumberExample
duration_hours(duration_from(1, 12, 0, 0, 0)) // returns 12Days
| Input | A duration instance. |
|---|---|
| Output | The days component of the duration. |
Signature
duration_days(a: Duration): NumberExample
duration_days(duration_from(2, 5, 30, 0, 0)) // returns 2Compare
| Input | Two duration instances. |
|---|---|
| Output | 1 if the first duration is longer, -1 if shorter, 0 if equal. |
Signature
duration_compare(a: Duration, b: Duration): NumberExample
duration_compare(duration_fromHours(2), duration_fromHours(1)) // returns 1Format
| Input | A duration and a format pattern string. |
|---|---|
| Output | The duration formatted according to the pattern. |
Signature
duration_format(a: Duration, b: String): StringExample
duration_format(duration_from(1, 2, 30, 0, 0), "d:HH:mm:ss") // returns "1:02:30:00"