NSDate

extension NSDate: DatabaseValueConvertible

NSDate 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) -> `Self`?