你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
totimespan()
将输入转换为 timespan 标量值。
弃用的别名:totime()
注意
如果可能,建议改用时间跨度文本。
语法
totimespan(
value)
详细了解语法约定。
参数
客户 | 类型 | 必需 | Description |
---|---|---|---|
value | string |
✔️ | 要转换为时间跨度的值。 |
返回
如果转换成功,则结果为 时间跨度 值。 否则,结果为 null。
示例
以下示例检查输入是否与定义的时间跨度匹配。
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)
输出
minStr | 日 | 小时 | 分钟 | 秒 | timespanMin |
---|---|---|---|---|---|
00:03:00 | 4.00:00:00 | 05:00:00 | 00:10:00 | 00:00:20 | 00:25:00 |