public sealed class Interval : IMessage<Interval>, IEquatable<Interval>, IDeepCloneable<Interval>, IBufferMessage, IMessage
Represents a time interval, encoded as a Timestamp start (inclusive) and a
Timestamp end (exclusive).
The start must be less than or equal to the end.
When the start equals the end, the interval is empty (matches no time).
When both start and end are unspecified, the interval matches any time.
[[["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-08-28 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eInterval\u003c/code\u003e class represents a time interval using a start and end \u003ccode\u003eTimestamp\u003c/code\u003e, where the start is inclusive and the end is exclusive.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eInterval\u003c/code\u003e class implements multiple interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, for use in Google Protobuf operations.\u003c/p\u003e\n"],["\u003cp\u003eAn \u003ccode\u003eInterval\u003c/code\u003e object can be created using the default constructor or by providing another \u003ccode\u003eInterval\u003c/code\u003e object, and the start and end times are controlled by the \u003ccode\u003eStartTime\u003c/code\u003e and \u003ccode\u003eEndTime\u003c/code\u003e properties.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eInterval\u003c/code\u003e class allows for methods such as \u003ccode\u003eClone()\u003c/code\u003e, \u003ccode\u003eCalculateSize()\u003c/code\u003e, \u003ccode\u003eEquals()\u003c/code\u003e, \u003ccode\u003eMergeFrom()\u003c/code\u003e, \u003ccode\u003eToString()\u003c/code\u003e and more to allow for object manipulation.\u003c/p\u003e\n"],["\u003cp\u003eThe Interval can be any point in time if both start and end time are unspecified, or empty if both the start and end times are equal.\u003c/p\u003e\n"]]],[],null,["# Class Interval (2.17.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.17.0 (latest)](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Interval)\n- [2.15.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.15.0/Google.Type.Interval)\n- [2.10.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.10.0/Google.Type.Interval)\n- [2.2.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.2.0/Google.Type.Interval) \n\n public sealed class Interval : IMessage\u003cInterval\u003e, IEquatable\u003cInterval\u003e, IDeepCloneable\u003cInterval\u003e, IBufferMessage, IMessage\n\nRepresents a time interval, encoded as a Timestamp start (inclusive) and a\nTimestamp end (exclusive).\n\nThe start must be less than or equal to the end.\nWhen the start equals the end, the interval is empty (matches no time).\nWhen both start and end are unspecified, the interval matches any time. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e Interval \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[Interval](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Interval), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Interval](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Interval), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Interval](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.Interval), [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### Interval()\n\n public Interval()\n\n### Interval(Interval)\n\n public Interval(Interval other)\n\nFields\n------\n\n### EndTimeFieldNumber\n\n public const int EndTimeFieldNumber = 2\n\nField number for the \"end_time\" field.\n\n### StartTimeFieldNumber\n\n public const int StartTimeFieldNumber = 1\n\nField number for the \"start_time\" field.\n\nProperties\n----------\n\n### Descriptor\n\n public static MessageDescriptor Descriptor { get; }\n\n### EndTime\n\n public Timestamp EndTime { get; set; }\n\nOptional. Exclusive end of the interval.\n\nIf specified, a Timestamp matching this interval will have to be before the\nend.\n\n### Parser\n\n public static MessageParser\u003cInterval\u003e Parser { get; }\n\n### StartTime\n\n public Timestamp StartTime { get; set; }\n\nOptional. Inclusive start of the interval.\n\nIf specified, a Timestamp matching this interval will have to be the same\nor after the start.\n\nMethods\n-------\n\n### CalculateSize()\n\n public int CalculateSize()\n\n### Clone()\n\n public Interval Clone()\n\n### Equals(Interval)\n\n public bool Equals(Interval 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### 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(Interval)\n\n public void MergeFrom(Interval other)\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)"]]