From 1f43d4a19831db85c12dbce0c661686c423ed740 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Thu, 13 Aug 2026 21:51:10 -0400 Subject: [PATCH 1/2] Clarify XmlConvert date-time formats Document the exact ParseExact behavior for the custom-format ToDateTimeOffset overloads and clarify UTC designator handling.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- xml/System.Xml/XmlConvert.xml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/xml/System.Xml/XmlConvert.xml b/xml/System.Xml/XmlConvert.xml index b9f186eaf40..38c140d9d43 100644 --- a/xml/System.Xml/XmlConvert.xml +++ b/xml/System.Xml/XmlConvert.xml @@ -1123,13 +1123,17 @@ The contains additional methods that validate token The string to convert. - The format from which is converted. The format parameter can be any subset of the W3C Recommendation for the XML dateTime type. (For more information, see the dateTime section of the XML Schema specification..) The string is validated against this format. + A .NET standard or custom date and time format string that specifies the required format of . Converts the supplied to a equivalent. The equivalent of the supplied string. with and the and flags. Leading and trailing white space is ignored, but `s` must otherwise exactly match `format`. The `format` parameter uses .NET [standard date and time format strings](/dotnet/standard/base-types/standard-date-and-time-format-strings) or [custom date and time format strings](/dotnet/standard/base-types/custom-date-and-time-format-strings), not XML Schema dateTime patterns. + + In a custom format string, the `z`, `zz`, and `zzz` specifiers require a signed numeric UTC offset. They don't match the XML UTC designator `Z`. Use the `K` custom format specifier when `s` can contain `Z`. + If the offset specified within the input string will cause an overflow in the deserialized representation of the DateTimeOffset, a FormatException is thrown. When more than seven digits are specified for fractional seconds, the value is rounded. For example, 00000004 becomes 0000000 and 00000005 becomes 0000001. @@ -1161,7 +1165,7 @@ The contains additional methods that validate token is . - or is an empty string or is not in the specified format. + is invalid, or doesn't exactly match under the invariant culture rules, except for leading or trailing white space. @@ -1206,13 +1210,17 @@ The contains additional methods that validate token The string to convert. - An array of formats from which can be converted. Each format in can be any subset of the W3C Recommendation for the XML dateTime type. (For more information, see the dateTime section of the XML Schema specification..) The string is validated against one of these formats. + An array of .NET standard or custom date and time format strings that specify the permitted formats of . Converts the supplied to a equivalent. The equivalent of the supplied string. with and the and flags. Leading and trailing white space is ignored, but `s` must otherwise exactly match one of the strings in `formats`. The `formats` parameter uses .NET [standard date and time format strings](/dotnet/standard/base-types/standard-date-and-time-format-strings) or [custom date and time format strings](/dotnet/standard/base-types/custom-date-and-time-format-strings), not XML Schema dateTime patterns. + + In a custom format string, the `z`, `zz`, and `zzz` specifiers require a signed numeric UTC offset. They don't match the XML UTC designator `Z`. Use the `K` custom format specifier when `s` can contain `Z`. + If the offset specified within the input string will cause an overflow in the deserialized representation of the DateTimeOffset, a FormatException is thrown. When more than seven digits are specified for fractional seconds, the value is rounded. For example, 00000004 becomes 0000000 and 00000005 becomes 0000001. @@ -1241,6 +1249,7 @@ The contains additional methods that validate token ]]> + An element of is invalid, or doesn't exactly match any element of under the invariant culture rules, except for leading or trailing white space. From 2d199e55d6342fdfe05e9a757c4d0d5452ae0436 Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Sat, 15 Aug 2026 17:13:12 -0700 Subject: [PATCH 2/2] Use whitespace as one word Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- xml/System.Xml/XmlConvert.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml/System.Xml/XmlConvert.xml b/xml/System.Xml/XmlConvert.xml index 38c140d9d43..f6457d873cc 100644 --- a/xml/System.Xml/XmlConvert.xml +++ b/xml/System.Xml/XmlConvert.xml @@ -1130,7 +1130,7 @@ The contains additional methods that validate token with and the and flags. Leading and trailing white space is ignored, but `s` must otherwise exactly match `format`. The `format` parameter uses .NET [standard date and time format strings](/dotnet/standard/base-types/standard-date-and-time-format-strings) or [custom date and time format strings](/dotnet/standard/base-types/custom-date-and-time-format-strings), not XML Schema dateTime patterns. + This overload is equivalent to calling with and the and flags. Leading and trailing whitespace is ignored, but `s` must otherwise exactly match `format`. The `format` parameter uses .NET [standard date and time format strings](/dotnet/standard/base-types/standard-date-and-time-format-strings) or [custom date and time format strings](/dotnet/standard/base-types/custom-date-and-time-format-strings), not XML Schema dateTime patterns. In a custom format string, the `z`, `zz`, and `zzz` specifiers require a signed numeric UTC offset. They don't match the XML UTC designator `Z`. Use the `K` custom format specifier when `s` can contain `Z`.