Google Cloud Spanner v1 API - Class Interval (5.1.0)

public sealed class Interval

Reference documentation and code samples for the Google Cloud Spanner v1 API class Interval.

Represents the Spanner Interval type.

Inheritance

object > Interval

Namespace

Google.Cloud.Spanner.V1

Assembly

Google.Cloud.Spanner.V1.dll

Properties

Days

public int Days { get; }

Day portion of this interval.

Property Value
Type Description
int

MaxValue

public static Interval MaxValue { get; }

Represents the maximum possible value of an Interval.

Property Value
Type Description
Interval

MinValue

public static Interval MinValue { get; }

Represents the minimum possible value of an Interval.

Property Value
Type Description
Interval

Months

public int Months { get; }

Month portion of this interval.

Property Value
Type Description
int

Nanoseconds

public BigInteger Nanoseconds { get; }

Nanosecond portion of this interval.

Property Value
Type Description
BigInteger

Zero

public static Interval Zero { get; }

Represents the zero Interval value.

Property Value
Type Description
Interval

Methods

FromDays(int)

public static Interval FromDays(int days)

Creates an interval from the given days.

Parameter
Name Description
days int
Returns
Type Description
Interval

FromMicroseconds(BigInteger)

public static Interval FromMicroseconds(BigInteger microseconds)

Creates an interval from the given microseconds.

Parameter
Name Description
microseconds BigInteger
Returns
Type Description
Interval

FromMilliseconds(BigInteger)

public static Interval FromMilliseconds(BigInteger milliseconds)

Creates an interval from the given milliseconds.

Parameter
Name Description
milliseconds BigInteger
Returns
Type Description
Interval

FromMonths(int)

public static Interval FromMonths(int months)

Creates an interval from the given months.

Parameter
Name Description
months int
Returns
Type Description
Interval

FromMonthsDaysNanos(int, int, BigInteger)

public static Interval FromMonthsDaysNanos(int months, int days, BigInteger nanos)

Creates an interval from the given months, days and nanoseconds.

Parameters
Name Description
months int
days int
nanos BigInteger
Returns
Type Description
Interval

FromNanoseconds(BigInteger)

public static Interval FromNanoseconds(BigInteger nanoseconds)

Creates an interval from the given nanoseconds.

Parameter
Name Description
nanoseconds BigInteger
Returns
Type Description
Interval

FromSeconds(decimal)

public static Interval FromSeconds(decimal seconds)

Creates an interval from the given seconds.

Parameter
Name Description
seconds decimal
Returns
Type Description
Interval

GetHashCode()

public override int GetHashCode()
Returns
Type Description
int
Overrides

Parse(string)

public static Interval Parse(string text)

Parses the string represantion in ISO 8601 format of a duration returning its Interval equivalent.

Parameter
Name Description
text string

The string representation of a duration in ISO 8601 format: P[n]Y[n]M[n]DT[n]H[n]M[n[.fraction]]S.

  • Each field has an individual sign.
  • Only seconds can be fractional with a maximum of 9 decimal positions for up to nanosecond precision.
  • Each part does not need to be normalized. For instance P1Y21M45DT47H250M3.245D is valid.
  • Not all parts need to be specified. For instance P3M, PT4H5M, P3YT5M are all valid.

Returns
Type Description
Interval

ToString()

public override string ToString()

Returns the ISO 8601 string representation of this Interval.

Returns
Type Description
string
Overrides

TryParse(string, out Interval)

public static bool TryParse(string text, out Interval interval)

Parses the string represantion in ISO 8601 format of a duration returning its Interval equivalent, if possible.

Parameters
Name Description
text string

The string representation of a duration in ISO 8601 format: P[n]Y[n]M[n]DT[n]H[n]M[n[.fraction]]S.

interval Interval

The resulting Interval value, if parsing was succesful. null otherwise.

Returns
Type Description
bool