Npgsql Api Docs |

# NpgsqlInterval Methods

The methods of the NpgsqlInterval structure are listed below. For a complete list of NpgsqlInterval structure members, see the NpgsqlInterval Members topic.

#### Public Static (Shared) Methods

Compare | Compares two NpgsqlInterval instances.
FromDays | Creates an NpgsqlInterval from a number of days.
FromHours | Creates an NpgsqlInterval from a number of hours.
FromMicroseconds | Creates an NpgsqlInterval from a number of microseconds.
FromMilliseconds | Creates an NpgsqlInterval from a number of milliseconds.
FromMinutes | Creates an NpgsqlInterval from a number of minutes.
FromMonths | Creates an NpgsqlInterval from a number of months.
FromSeconds | Creates an NpgsqlInterval from a number of seconds.
FromTicks | Creates an NpgsqlInterval from a number of ticks.
Parse | Parses a String and returns a NpgsqlInterval instance. Designed to use the formats generally returned by PostgreSQL.
TryParse | Attempt to parse a String to produce an NpgsqlInterval.

#### Public Instance Methods

Add | Adds another interval to this instance and returns the result.
Canonicalize |
CompareTo | Overloaded. Compares this instance with another/
Duration | This absolute value of this instance. In the case of some, but not all, components being negative, the rules used for justification are used to determine if the instance is positive or negative.
Equals | Overloaded. Returns true if another NpgsqlInterval is exactly the same as this instance.
GetHashCode | A hash code suitable for uses with hashing algorithms.
GetType (inherited from Object) |
JustifyDays | Equivalent to PostgreSQL's justify_days function.
JustifyInterval | Equivalent to PostgreSQL's justify_interval function.
JustifyMonths | Equivalent to PostgreSQL's justify_months function.
Negate | Returns an NpgsqlInterval whose value is the negated value of this instance.
Subtract | Subtracts another interval from this instance and returns the result.
ToString | Create a String representation of the NpgsqlInterval instance. The format returned is of the form: [M mon[s]] [d day[s]] [HH:mm:ss[.f[f[f[f[f[f[f[f[f]]]]]]]]]] A zero NpgsqlInterval is represented as 00:00:00 Ticks are 100ns, Postgress resolution is only to 1µs at most. Hence we lose 1 or more decimal precision in storing values in the database. Despite this, this method will output that extra digit of precision. It's forward-compatible with any future increases in resolution up to 100ns, and also makes this ToString() more applicable to any other use-case.
UnjustifyDays | Opposite to PostgreSQL's justify_days function.
UnjustifyInterval | Opposite to PostgreSQL's justify_interval function.
UnjustifyMonths | Opposite to PostgreSQL's justify_months function.

#### See Also

NpgsqlInterval Class | NpgsqlTypes Namespace | Ticks | JustifyDays | JustifyMonths | Canonicalize