azure - 如何使用powershell将 "PT5H"转换为刻度?

标签 azure powershell

我正在尝试使用 powershell 将“PT5H”转换为刻度格式。但面临以下错误:

System.Management.Automation.ParameterBindingArgumentTransformationException: Cannot process argument transformation on parameter 'SuppressionDuration'. Cannot convert value "PT5H" to type "System.TimeSpan". Error: "String was not recognized as a valid TimeSpan."

有人可以帮我将“PT5H”(字符串)转换为刻度吗?

最佳答案

您可以使用XmlConvert.ToTimeSpan() method解析 ISO8601 持续时间字符串:

$duration = [System.Xml.XmlConvert]::ToTimeSpan('PT5H')
Command-Name -SuppressionDuration $duration

关于azure - 如何使用powershell将 "PT5H"转换为刻度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75055343/

相关文章:

powershell - Add-AzureRmServiceFabricClusterCertificate 以错误 'Certificates cannot be added and removed at the same time.' 结束

java - 生成线程利用率摘要

sql - 来自 Powershell Invoke-Sqlcmd 的错误检测并不总是有效?

powershell - 获取 powershell 以显示可以在驱动器上找到某个文件的所有路径

windows - 为什么 powershell 说 cl.exe 不被识别?

powershell - 如何在一行上为用户输入日期和时间

azure - 我可以在 Windows Azure 中使用什么 token 颁发者?

azure - 使用tinkerpop3在同一查询中输出顶点和相邻顶点

c# - 添加 Azure Function (v3) 绑定(bind)到 BlobTrigger 的 RequestTelemetry 的自定义属性

c# - 条目(数据库)已添加