Mallard
Search Results for

    Show / Hide Table of Contents

    Struct DuckDbInterval

    Time interval in DuckDB.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Mallard.Types
    Assembly: Mallard.dll
    Syntax
    public struct DuckDbInterval
    Remarks

    Note that the DuckDB's time intervals use 3 basis units: months, days, microseconds, unlike .NET TimeSpan type.

    Fields

    | Edit this page View Source

    Days

    The number of days to offset by in time calculations.

    Declaration
    public int Days
    Field Value
    Type Description
    int
    | Edit this page View Source

    Microseconds

    The number of microseconds to offset by in time calculations.

    Declaration
    public int Microseconds
    Field Value
    Type Description
    int
    | Edit this page View Source

    Months

    The number of months to offset by in time calculations.

    Declaration
    public int Months
    Field Value
    Type Description
    int

    Methods

    | Edit this page View Source

    FromTimeSpan(TimeSpan, bool)

    Convert from a .NET time span.

    Declaration
    public static DuckDbInterval FromTimeSpan(TimeSpan timeSpan, bool exact = true)
    Parameters
    Type Name Description
    TimeSpan timeSpan

    The desired time span to convert to the DuckDB representation.

    bool exact

    If true, fail if timeSpan cannot be represented exactly in DuckDB. If false, the timestamp will be silently rounded to the nearest time interval in microseconds for storage into DuckDB.

    Returns
    Type Description
    DuckDbInterval

    The DuckDB interval.

    Exceptions
    Type Condition
    ArgumentException

    There are fractional microseconds and exact is true.

    | Edit this page View Source

    ToTimeSpan()

    Convert to a .NET time span if possible.

    Declaration
    public readonly TimeSpan ToTimeSpan()
    Returns
    Type Description
    TimeSpan
    Exceptions
    Type Condition
    InvalidOperationException

    This instance contains a month component (Months is non-zero), which cannot be represented in a TimeSpan (since the number of days in a month differs between months).

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX