Hello @Manu Michael Samuel , Welcome to Microsoft Q&A,
During the testing, we can't reproduce this problem, but for this problem, you could convert PT5H44M15.957S
to 05:44:09.57
manually.
For example:
public static class TimeTranslator
{
public static string ToTimeSpanString(string raw)
{
if (string.IsNullOrWhiteSpace(raw))
return "";
else
raw = raw.ToUpperInvariant();
var newValue = new StringBuilder();
foreach (var c in raw)
{
if (" -0123456789".Contains(c))
{
newValue.Append(c);
}
else
{
var result = TranslateToNumber(c);
if (result != null)
newValue.Append(result);
}
}
return newValue.ToString();
}
static string TranslateToNumber(char c)
{
if ("PT".Contains(c))
return string.Empty;
else if ("H".Contains(c))
return ":";
else if ("M".Contains(c))
return ":";
else if ("S".Contains(c))
return string.Empty;
else if (".".Contains(c))
return ".";
return null;
}
}
Usage
var time = TimeTranslator.ToTimeSpanString("PT5H44M15.957S");
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.