How to Convert ISO 8601 Duration to TimeSpan in VB.Net?

前端 未结 3 1879
死守一世寂寞
死守一世寂寞 2020-12-30 04:38

Is there a standard library method that converts a string that has duration in the standard ISO 8601 Duration (also used in XSD for its duration type) format in

3条回答
  •  离开以前
    2020-12-30 04:54

    This will convert from xs:duration to TimeSpan:

    System.Xml.XmlConvert.ToTimeSpan("P0DT1H0M0S")
    

    See http://msdn.microsoft.com/en-us/library/system.xml.xmlconvert.totimespan.aspx

提交回复
热议问题