DurationOperations¶
Namespace for operations on durations.
This class cannot be instantiated directly. It can only be accessed using the dur attribute of a cell.
Examples:
pipeline example {
val column = Column("a", [Duration(days=-1), Duration(days = 0), Duration(days = 1)]);
out column.transform((cell) -> cell.dur.abs());
}
Stub code in DurationOperation.sdsstub
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
abs¶
Get the absolute value of the duration.
Results:
| Name | Type | Description |
|---|---|---|
cell |
Cell<Duration?> |
The absolute value. |
Examples:
pipeline example {
val column = Column("a", [Duration(days=-1), Duration(days = 1), null]);
out column.transform((cell) -> cell.dur.abs());
}
fullDays¶
Get the number of full days in the duration. The result is rounded toward zero.
Results:
| Name | Type | Description |
|---|---|---|
cell |
Cell<Int?> |
The number of full days. |
Examples:
pipeline example {
val column = Column("a", [Duration(hours = 25), Duration(hours = 23), null]);
out column.transform((cell) -> cell.dur.fullDays());
}
Stub code in DurationOperation.sdsstub
fullHours¶
Get the number of full hours in the duration. The result is rounded toward zero.
Results:
| Name | Type | Description |
|---|---|---|
cell |
Cell<Int?> |
The number of full hours. |
Examples:
pipeline example {
val column = Column("a", [Duration(minutes = 61), Duration(minutes = 59), null]);
out column.transform((cell) -> cell.dur.fullHours());
}
Stub code in DurationOperation.sdsstub
fullMicroseconds¶
Get the number of full microseconds in the duration. The result is rounded toward zero.
Since durations only have microsecond resolution at the moment, the rounding has no effect. This may change in the future.
Results:
| Name | Type | Description |
|---|---|---|
cell |
Cell<Int?> |
The number of full microseconds. |
Examples:
pipeline example {
val column = Column("a", [Duration(microseconds = 1001), Duration(microseconds = 999), null]);
out column.transform((cell) -> cell.dur.fullMicroseconds());
}
Stub code in DurationOperation.sdsstub
fullMilliseconds¶
Get the number of full milliseconds in the duration. The result is rounded toward zero.
Results:
| Name | Type | Description |
|---|---|---|
cell |
Cell<Int?> |
The number of full milliseconds. |
Examples:
pipeline example {
val column = Column("a", [Duration(microseconds = 1001), Duration(microseconds = 999), null]);
out column.transform((cell) -> cell.dur.fullMilliseconds());
}
Stub code in DurationOperation.sdsstub
fullMinutes¶
Get the number of full minutes in the duration. The result is rounded toward zero.
Results:
| Name | Type | Description |
|---|---|---|
cell |
Cell<Int?> |
The number of full minutes. |
Examples:
pipeline example {
val column = Column("a", [Duration(seconds = 61), Duration(seconds = 59), null]);
out column.transform((cell) -> cell.dur.fullMinutes());
}
Stub code in DurationOperation.sdsstub
fullSeconds¶
Get the number of full seconds in the duration. The result is rounded toward zero.
Results:
| Name | Type | Description |
|---|---|---|
cell |
Cell<Int?> |
The number of full seconds. |
Examples:
pipeline example {
val column = Column("a", [Duration(milliseconds = 1001), Duration(milliseconds = 999), null]);
out column.transform((cell) -> cell.dur.fullSeconds());
}
Stub code in DurationOperation.sdsstub
fullWeeks¶
Get the number of full weeks in the duration. The result is rounded toward zero.
Results:
| Name | Type | Description |
|---|---|---|
cell |
Cell<Int?> |
The number of full weeks. |
Examples:
pipeline example {
val column = Column("a", [Duration(days = 8), Duration(days = 6), null]);
out column.transform((cell) -> cell.dur.fullWeeks());
}
Stub code in DurationOperation.sdsstub
toString¶
Convert the duration to a string.
The following formats are supported:
"iso": The duration is represented in the ISO 8601 format. This is the default."pretty": The duration is represented in a human-readable format.
API Stability
Do not rely on the exact output of the "pretty" format. In future versions, we may change it without prior
notice.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
format |
literal<"iso", "pretty"> |
The format to use. | "iso" |
Results:
| Name | Type | Description |
|---|---|---|
cell |
Cell<String?> |
The string representation. |