Roundtripping SoapDuration and TimeSpan

Clemens Vasters writes about XSD duration and its relationship with the .NET Timespan Type.

Another quirk I have found with usage of these types is the fact that the conversion to the SoapDuration Type was not what I originally expected. It turns out that a Timespan that features a period of "about a year" highlights the issue.

In fact, the conversion to SoapDuration assumes a year to contain 360 days (a month is considered to be 30 days). Therefore, a Timespan of 365 days yields a SoapDuration of "P1Y0M5D", suggesting 365 days = 1 year and 5 days.

The algorithm is based on the standard ISO 8601.

Published Wednesday, December 15, 2004 1:52 PM by mj_naughton
Filed under:

Comments

# re: Roundtripping SoapDuration and TimeSpan

Wednesday, May 26, 2010 2:00 PM by Brianary

Where in ISO 8601 does it specify 360 days per year and 30 days per month?

Leave a Comment

(required) 
(required) 
(optional)
(required)