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 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
yearYear
monthMonth
dayDay
hoursHour
minutesMinutes
secondsSeconds
-
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
fromDate
calendarCalendar used for Date
-
Decode DateTime
Throws
BluetoothDecodeErrorDeclaration
Swift
static func decode(data: Data) -> DateTimeParameters
dataDateTime Data
Return Value
DateTime Instance
-
Returns a Boolean value indicating whether two values are equal.
Equality is the inverse of inequality. For any values
aandb,a == bimplies thata != bisfalse.Declaration
Swift
public static func == (lhs: DateTime, rhs: DateTime) -> BoolParameters
lhsA value to compare.
rhsAnother value to compare.
-
Encodes Object into Data
Declaration
Swift
public func encode() -> Result<Data, BluetoothEncodeError>Return Value
Encoded Data Result