Mallard
Search Results for

    Show / Hide Table of Contents

    Struct DuckDbTimestamp

    DuckDB's representation of a timestamp.

    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 DuckDbTimestamp
    Remarks

    This type exists mainly to enable date/time values reported by DuckDB to be read directly from the memory of a DuckDB vector. The fields are not wrapped in properties to allow vectorized processing (i.e. SIMD), and DuckDB already essentially guarantees a stable layout of this structure.

    Constructors

    | Edit this page View Source

    DuckDbTimestamp(long)

    DuckDB's representation of a timestamp.

    Declaration
    public DuckDbTimestamp(long microseconds)
    Parameters
    Type Name Description
    long microseconds

    The timestamp value represented as the number of microseconds since the Unix epoch (January 1, 1970, 00:00:00 UTC).

    Remarks

    This type exists mainly to enable date/time values reported by DuckDB to be read directly from the memory of a DuckDB vector. The fields are not wrapped in properties to allow vectorized processing (i.e. SIMD), and DuckDB already essentially guarantees a stable layout of this structure.

    Fields

    | Edit this page View Source

    Microseconds

    Number of microseconds elapsed since midnight 1970-01-01 (Unix epoch).

    Declaration
    public long Microseconds
    Field Value
    Type Description
    long

    Methods

    | Edit this page View Source

    FromDateTime(DateTime, bool)

    Convert from a standard DateTime.

    Declaration
    public static DuckDbTimestamp FromDateTime(DateTime dateTime, bool exact = true)
    Parameters
    Type Name Description
    DateTime dateTime

    Desired date/time to represent in DuckDB.

    bool exact

    If true, fail if dateTime cannot be represented exactly in DuckDB. If false, the timestamp will be silently rounded to the nearest timepoint in microseconds (since the epoch) for storage into DuckDB. (The earliest and latest times allowed in DateTime are both representable in DuckDB, so underflow or overflow cannot occur when converting to DuckDbTimestamp, only rounding.)

    Returns
    Type Description
    DuckDbTimestamp

    The DuckDB representation of the date/time.

    Exceptions
    Type Condition
    ArgumentException

    There are fractional microseconds and exact is true.

    | Edit this page View Source

    ToDateTime()

    Convert to a standard DateTime.

    Declaration
    public readonly DateTime ToDateTime()
    Returns
    Type Description
    DateTime

    The DateTime instance that represents the same point in time as this DuckDB timestamp. Its DateTimeKind will be set to Unspecified.

    Exceptions
    Type Condition
    OverflowException

    When this DuckDB timestamp cannot be represented in an instance of DateTime, because the time point exists earlier than (underflows) MinValue or later than (overflows) MaxValue. (DateTime has finer resolution than microseconds, so the conversion is always exact if there is no does not overflow or underflow.)

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