# Class DateExtensions (2.17.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.17.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.DateExtensions)
- [2.15.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.CommonProtos/2.15.0/Google.Type.DateExtensions)
- [2.10.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.CommonProtos/2.10.0/Google.Type.DateExtensions)
- [2.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.CommonProtos/2.2.0/Google.Type.DateExtensions)

    public static class DateExtensions

Extension methods built for [Date](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date).

## Inheritance

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

## 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.Type](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type)

## Assembly

Google.Api.CommonProtos.dll

## Methods

### ToDate(DateTime)

    public static Date ToDate(this DateTime dateTime)

Converts the [Date](https://learn.microsoft.com/dotnet/api/system.datetime.date) part of [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) to [Date](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `dateTime` | `https://learn.microsoft.com/dotnet/api/system.datetime` The [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime) instance being converted. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date` | The [Date](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date). |

### ToDate(DateTimeOffset)

    public static Date ToDate(this DateTimeOffset dateTimeOffset)

Converts the [Date](https://learn.microsoft.com/dotnet/api/system.datetimeoffset.date) part of [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset) to [Date](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `dateTimeOffset` | `https://learn.microsoft.com/dotnet/api/system.datetimeoffset` The [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset) instance being converted. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date` | The converted [Date](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date). |