1.73.0 (latest) 1.69.0 1.68.0 1.60.0 1.59.0 1.55.0 1.50.0

    public static class DiscoveryFormat

Utility methods to convert to/from Discovery API formats.
See <https://developers.google.com/discovery/v1/type-format>

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> DiscoveryFormat

## Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Apis.Util](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.md.txt)

## Assembly

Google.Apis.Core.dll

## Remarks

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](https://learn.microsoft.com/dotnet/api/system.datetime) and [object](https://learn.microsoft.com/dotnet/api/system.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](https://learn.microsoft.com/dotnet/api/system.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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `DateTimeOffset` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### FormatDateTimeOffsetToGoogleDateTime(DateTimeOffset?)

    public static string FormatDateTimeOffsetToGoogleDateTime(DateTimeOffset? value)

Formats a [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) value appropriately for a Discovery "google-datetime" value.
This automatically converts the given value to UTC before formatting.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `DateTimeOffset` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### ParseDateTimeToDateTimeOffset(string)

    public static DateTimeOffset? ParseDateTimeToDateTimeOffset(string value)

Parses a Discovery "date-time" format value to [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `DateTimeOffset` |   |

### ParseGoogleDateTimeToDateTimeOffset(string)

    public static DateTimeOffset? ParseGoogleDateTimeToDateTimeOffset(string value)

Parses a Discovery "google-datetime" format value to [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `DateTimeOffset` |   |