Methods starting "Parse" are for parsing the Discovery format to a .NET type.
Methods starting "Format" are for formatting .NET types to Discovery formats.
This class does not provide methods for DateTime and object
conversions; properties with a type of DateTime or object are marked as obsolete in the generated code,
and have legacy behavior which cannot reasonably be changed for backward compatibility reasons.
Methods
FormatDateTimeOffsetToDateTime(DateTimeOffset?)
public static string FormatDateTimeOffsetToDateTime(DateTimeOffset? value)
Formats a DateTime value appropriately for a Discovery "date-time" value.
This does not automatically convert the given value to UTC; some services require values
to be presented in UTC, in which case user code should ensure that only UTC values are
specified.
public static DateTimeOffset? ParseDateTimeToDateTimeOffset(string value)
Parses a Discovery "date-time" format value to DateTimeOffset.
The value must start in the format "yyyy-MM-ddTHH:mm:ss", with optional milliseconds,
microseconds and nanoseconds. A UTC offset may be provided with up to second precision
(e.g. +01, -02:30, +03:45:12), or "Z" for UTC. If nanosecond precision is provided,
the value is truncated to .NET "tick" precision (100ns). If the UTC offset has a non-zero
seconds component, a value is returned which preserves the instant in time, but truncates
the UTC offset to the minute.
public static DateTimeOffset? ParseGoogleDateTimeToDateTimeOffset(string value)
Parses a Discovery "google-datetime" format value to DateTimeOffset.
The value must start in the format "yyyy-MM-ddTHH:mm:ss", with optional milliseconds,
microseconds and nanoseconds, and a trailing 'Z' to indicate UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis webpage details the \u003ccode\u003eDiscoveryFormat\u003c/code\u003e class within the \u003ccode\u003eGoogle.Apis.Util\u003c/code\u003e namespace, providing utility methods for converting data to and from Discovery API formats.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eDiscoveryFormat\u003c/code\u003e class offers methods to parse Discovery format strings into .NET \u003ccode\u003eDateTimeOffset\u003c/code\u003e types and format .NET \u003ccode\u003eDateTimeOffset\u003c/code\u003e types into Discovery formats.\u003c/p\u003e\n"],["\u003cp\u003eMethods prefixed with "Parse" handle conversions from Discovery formats to .NET types, while those prefixed with "Format" convert .NET types to Discovery formats.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eFormatDateTimeOffsetToDateTime\u003c/code\u003e method formats \u003ccode\u003eDateTimeOffset\u003c/code\u003e values for a Discovery "date-time," and \u003ccode\u003eFormatDateTimeOffsetToGoogleDateTime\u003c/code\u003e for a Discovery "google-datetime" format, with the latter automatically converting to UTC.\u003c/p\u003e\n"],["\u003cp\u003eThis class doesn't handle conversions for \u003ccode\u003eDateTime\u003c/code\u003e and \u003ccode\u003eobject\u003c/code\u003e types because of legacy behavior; therefore, properties of these types in generated code are marked as obsolete.\u003c/p\u003e\n"]]],[],null,[]]