Can anyone advise on how to convert a timespan or int to an ISO8601 duration string?
1hour and 30 minutes would result to PT1H30M
e.g. int duration = 90; string isoString = duration.ToIsoDuration();
Can anyone advise on how to convert a timespan or int to an ISO8601 duration string?
1hour and 30 minutes would result to PT1H30M
e.g. int duration = 90; string isoString = duration.ToIsoDuration();
found the solution myself, so I thought I'd share:
TimeSpan timeSpan = new TimeSpan(0, value, 0);
return XmlConvert.ToString(timeSpan);