public sealed class Date : IMessage<Date>, IEquatable<Date>, IDeepCloneable<Date>, IBufferMessage, IMessage
Represents a whole or partial calendar date, such as a birthday. The time of
day and time zone are either specified elsewhere or are insignificant. The
date is relative to the Gregorian Calendar. This can represent one of the
following:
A full date, with non-zero year, month, and day values
A month and day value, with a zero year, such as an anniversary
A year on its own, with zero month and day values
A year and month value, with a zero day, such as a credit card expiration
date
Related types are [google.type.TimeOfDay][google.type.TimeOfDay] andgoogle.protobuf.Timestamp.
Day of a month. Must be from 1 to 31 and valid for the year and month, or 0
to specify a year by itself or a year and month where the day isn't
significant.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eDate\u003c/code\u003e class represents a calendar date, which can be a full date, a month and day, a year alone, or a year and month.\u003c/p\u003e\n"],["\u003cp\u003eThis class supports various date formats, such as those found in birthdays, anniversaries, or credit card expiration dates, while allowing for the omission of time and timezone.\u003c/p\u003e\n"],["\u003cp\u003eIt includes properties for \u003ccode\u003eYear\u003c/code\u003e, \u003ccode\u003eMonth\u003c/code\u003e, and \u003ccode\u003eDay\u003c/code\u003e, as well as methods for converting to and from \u003ccode\u003eDateTime\u003c/code\u003e and \u003ccode\u003eDateTimeOffset\u003c/code\u003e objects.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eDate\u003c/code\u003e class is part of the \u003ccode\u003eGoogle.Type\u003c/code\u003e namespace within the \u003ccode\u003eGoogle.Api.CommonProtos.dll\u003c/code\u003e assembly, implementing interfaces like \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable<Date>\u003c/code\u003e, and \u003ccode\u003eIDeepCloneable<Date>\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods like \u003ccode\u003eClone()\u003c/code\u003e, \u003ccode\u003eEquals()\u003c/code\u003e, \u003ccode\u003eMergeFrom()\u003c/code\u003e, \u003ccode\u003eWriteTo()\u003c/code\u003e, and \u003ccode\u003eCalculateSize()\u003c/code\u003e to facilitate object manipulation, comparison, data merging, and data transfer related to dates.\u003c/p\u003e\n"]]],[],null,["# Class Date (2.17.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.17.0 (latest)](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date)\n- [2.15.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.15.0/Google.Type.Date)\n- [2.10.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.10.0/Google.Type.Date)\n- [2.2.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.2.0/Google.Type.Date) \n\n public sealed class Date : IMessage\u003cDate\u003e, IEquatable\u003cDate\u003e, IDeepCloneable\u003cDate\u003e, IBufferMessage, IMessage\n\nRepresents a whole or partial calendar date, such as a birthday. The time of\nday and time zone are either specified elsewhere or are insignificant. The\ndate is relative to the Gregorian Calendar. This can represent one of the\nfollowing:\n\n- A full date, with non-zero year, month, and day values\n- A month and day value, with a zero year, such as an anniversary\n- A year on its own, with zero month and day values\n- A year and month value, with a zero day, such as a credit card expiration date\n\nRelated types are \\[google.type.TimeOfDay\\]\\[google.type.TimeOfDay\\] and\n`google.protobuf.Timestamp`. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e Date \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[Date](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Date](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Date](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)\n\nNamespace\n---------\n\n[Google.Type](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type)\n\nAssembly\n--------\n\nGoogle.Api.CommonProtos.dll\n\nConstructors\n------------\n\n### Date()\n\n public Date()\n\n### Date(Date)\n\n public Date(Date other)\n\nFields\n------\n\n### DayFieldNumber\n\n public const int DayFieldNumber = 3\n\nField number for the \"day\" field.\n\n### MonthFieldNumber\n\n public const int MonthFieldNumber = 2\n\nField number for the \"month\" field.\n\n### YearFieldNumber\n\n public const int YearFieldNumber = 1\n\nField number for the \"year\" field.\n\nProperties\n----------\n\n### Day\n\n public int Day { get; set; }\n\nDay of a month. Must be from 1 to 31 and valid for the year and month, or 0\nto specify a year by itself or a year and month where the day isn't\nsignificant.\n\n### Descriptor\n\n public static MessageDescriptor Descriptor { get; }\n\n### Month\n\n public int Month { get; set; }\n\nMonth of a year. Must be from 1 to 12, or 0 to specify a year without a\nmonth and day.\n\n### Parser\n\n public static MessageParser\u003cDate\u003e Parser { get; }\n\n### Year\n\n public int Year { get; set; }\n\nYear of the date. Must be from 1 to 9999, or 0 to specify a date without\na year.\n\nMethods\n-------\n\n### CalculateSize()\n\n public int CalculateSize()\n\n### Clone()\n\n public Date Clone()\n\n### Equals(Date)\n\n public bool Equals(Date other)\n\n### Equals(object)\n\n public override bool Equals(object other)\n\n**Overrides** \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object))\n\n### FromDateTime(DateTime)\n\n public static Date FromDateTime(DateTime dateTime)\n\nCreates a [Date](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date) instance from the [Date](https://learn.microsoft.com/dotnet/api/system.datetime.date) part of [DateTime](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.DateTime).\n\n### FromDateTimeOffset(DateTimeOffset)\n\n public static Date FromDateTimeOffset(DateTimeOffset dateTimeOffset)\n\nCreates a [Date](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date) instance from the [Date](https://learn.microsoft.com/dotnet/api/system.datetimeoffset.date) part of [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset).\n\n### GetHashCode()\n\n public override int GetHashCode()\n\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### MergeFrom(CodedInputStream)\n\n public void MergeFrom(CodedInputStream input)\n\n### MergeFrom(Date)\n\n public void MergeFrom(Date other)\n\n### ToDateTime()\n\n public DateTime ToDateTime()\n\nConverts [Date](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date) to [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime).\n\n### ToDateTimeOffset()\n\n public DateTimeOffset ToDateTimeOffset()\n\nConverts [Date](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Date) to [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset).\n\n### ToString()\n\n public override string ToString()\n\n**Overrides** \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\n### WriteTo(CodedOutputStream)\n\n public void WriteTo(CodedOutputStream output)"]]