หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Converts the input to a timespan scalar value.
Deprecated aliases: totime()
Note
When possible, we recommend using timespan literals instead.
Syntax
totimespan(value)
Learn more about syntax conventions.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| value | string |
✔️ | The value to convert to a timespan. |
Returns
If conversion is successful, result is a timespan value. Else, result is null.
Example
The following example shows different usage of totimespan:
let value=5;
print minsStr=totimespan("0.00:03:00"), days=totimespan(4d), hour=totimespan(value * 1h),
mins=totimespan(value * 2m), seconds=totimespan(5 * 4s), timespanMin=timespan(25min)
Output
| minsStr | days | hour | mins | seconds | timespanMin |
|---|---|---|---|---|---|
| 00:03:00 | 4.00:00:00 | 05:00:00 | 00:10:00 | 00:00:20 | 00:25:00 |