Date

extension Date: DatabaseValueConvertible
extension Date: StatementColumnConvertible

Date is stored in the database using the format “yyyy-MM-dd HH:mm:ss.SSS”, in the UTC time zone.

  • Returns a database value that contains the date encoded as “yyyy-MM-dd HH:mm:ss.SSS”, in the UTC time zone.

    Declaration

    Swift

    public var databaseValue: DatabaseValue { get }
  • Returns a date initialized from dbValue, if possible.

    If database value contains a number, that number is interpreted as a timeinterval since 00:00:00 UTC on 1 January 1970.

    If database value contains a string, that string is interpreted as a SQLite date in the UTC time zone. Nil is returned if the date string does not contain at least the year, month and day components. Other components (minutes, etc.) are set to zero if missing.

    Declaration

    Swift

    public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> Date?
  • Creates a date from a Julian Day.

    Declaration

    Swift

    public init?(julianDay: Double)
  • Returns a value initialized from a raw SQLite statement pointer.

    Declaration

    Swift

    @inline(__always)
    @inlinable
    public init?(sqliteStatement: SQLiteStatement, index: Int32)

    Parameters

    sqliteStatement

    A pointer to an SQLite statement.

    index

    The column index.