# Struct NpgsqlInterval

Namespace
  NpgsqlTypes

Assembly
  Npgsql.dll

A raw representation of the PostgreSQL interval datatype. Use only when TimeSpan or NodaTime Period do not have sufficient range to handle your values.

    public readonly struct NpgsqlInterval : IEquatable<NpgsqlInterval>

Implements
  IEquatable<NpgsqlInterval>

Inherited Members
  ValueType.ToString()
  object.Equals(object, object)
  object.GetType()
  object.ReferenceEquals(object, object)

## Remarks

See https://www.postgresql.org/docs/current/static/datatype-geometric.html.

Do not use this type unless you have to: prefer TimeSpan or NodaTime Period when possible.

## Constructors

### NpgsqlInterval(int, int, long)

Constructs an NpgsqlInterval.

    public NpgsqlInterval(int months, int days, long time)

#### Parameters

`months` int
`days` int
`time` long

## Properties

### Days

Days, after time for alignment.

    public int Days { get; }

#### Property Value

int

### Months

Months and years, after time for alignment.

    public int Months { get; }

#### Property Value

int

### Time

Remaining time unit smaller than a day, in microseconds.

    public long Time { get; }

#### Property Value

long

## Methods

### Equals(NpgsqlInterval)

Indicates whether the current object is equal to another object of the same type.

    public bool Equals(NpgsqlInterval other)

#### Parameters

`other` NpgsqlInterval

  An object to compare with this object.

#### Returns

bool

  true if the current object is equal to the `other` parameter; otherwise, false.

### Equals(object?)

Indicates whether this instance and a specified object are equal.

    public override bool Equals(object? obj)

#### Parameters

`obj` object

  The object to compare with the current instance.

#### Returns

bool

  true if `obj` and this instance are the same type and represent the same value; otherwise, false.

### GetHashCode()

Returns the hash code for this instance.

    public override int GetHashCode()

#### Returns

int

  A 32-bit signed integer that is the hash code for this instance.