DateTime

public struct DateTime : Hashable
extension DateTime: Equatable
extension DateTime: BluetoothEncodable

Bluetooth Date Time Type

  • Year

    Year as defined by the Gregorian calendar. Valid between 1582 and 9999

    Declaration

    Swift

    private(set) public var year: UInt16? { get }
  • Month

    Month of the year as defined by the Gregorian calendar

    Declaration

    Swift

    private(set) public var month: Month { get }
  • day

    Day of Month

    Day of the month as defined by the Gregorian calendar

    Declaration

    Swift

    private(set) public var day: UInt8? { get }
  • Hours

    Number of hours past midnight

    Declaration

    Swift

    private(set) public var hours: UInt8 { get }
  • Minutes

    Number of minutes since the start of the hour

    Declaration

    Swift

    private(set) public var minutes: UInt8 { get }
  • Seconds

    Number of seconds since the start of the minute

    Declaration

    Swift

    private(set) public var seconds: UInt8 { get }
  • Create Bluetooth Date Time Type

    Declaration

    Swift

    public init(year: UInt16?, month: Month, day: UInt8?, hours: UInt8, minutes: UInt8, seconds: UInt8)

    Parameters

    year

    Year

    month

    Month

    day

    Day

    hours

    Hour

    minutes

    Minutes

    seconds

    Seconds

  • Creates a DateTime Object from the current date

    Dates are represented in the Gregorian Calendar using current timezone

    Declaration

    Swift

    public static var fromCurrentDate: DateTime { get }
  • Create Bluetooth Date Time Type

    Declaration

    Swift

    public init(_ from: Date, calendar: Calendar = Calendar(identifier: .gregorian))

    Parameters

    from

    Date

    calendar

    Calendar used for Date

  • Decode DateTime

    Throws

    BluetoothDecodeError

    Declaration

    Swift

    static func decode(data: Data) -> DateTime

    Parameters

    data

    DateTime Data

    Return Value

    DateTime Instance

  • Returns a Boolean value indicating whether two values are equal.

    Equality is the inverse of inequality. For any values a and b, a == b implies that a != b is false.

    Declaration

    Swift

    public static func == (lhs: DateTime, rhs: DateTime) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.

  • Encodes Object into Data

    Declaration

    Swift

    public func encode() -> Result<Data, BluetoothEncodeError>

    Return Value

    Encoded Data Result