TimeObject

Objective-C


@interface TimeObject : NSObject

Swift

class TimeObject : NSObject

This class encapsulates time object information.

  • Initializes and returns a newly allocated object using the model data.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithModelData:(nonnull void *)data;
  • Returns the model data.

    Declaration

    Objective-C

    - (nonnull void *)getModelData;
  • Check if the date is valid.

    Declaration

    Objective-C

    - (BOOL)isValid;

    Swift

    func isValid() -> Bool
  • Sleep in this thread for specified number of milliseconds.

    Declaration

    Objective-C

    - (void)milliSecondSleep:(unsigned int)msec;

    Swift

    func milliSecondSleep(_ msec: UInt32)
  • Number of milliseconds that have passed since 1970-01-01T00:00:00.

    Declaration

    Objective-C

    - (NSUInteger)getEpoch;

    Swift

    func getEpoch() -> UInt
  • Returns a time object with local time.

    Declaration

    Objective-C

    - (nonnull TimeObject *)getLocalTime;

    Swift

    func getLocalTime() -> TimeObject
  • Returns a time object with universal time.

    Declaration

    Objective-C

    - (nonnull TimeObject *)getUniversalTime;

    Swift

    func getUniversalTime() -> TimeObject
  • Set time object to universal time.

    Declaration

    Objective-C

    - (void)setUniversalTime;

    Swift

    func setUniversalTime()
  • Set time object to local time.

    Declaration

    Objective-C

    - (void)setLocalTime;

    Swift

    func setLocalTime()
  • Number of milliseconds that have passed since 1970-01-01T00:00:00.

    Declaration

    Objective-C

    - (NSUInteger)asInt;

    Swift

    func asInt() -> UInt
  • Set the time from a timestamp. @details Timestamp is the number of milliseconds that have passed since 1970-01-01T00:00:00.

    Declaration

    Objective-C

    - (void)fromInt:(NSInteger)timestamp;

    Swift

    func fromInt(_ timestamp: Int)
  • Get the year.

    Declaration

    Objective-C

    - (int)getYear;

    Swift

    func getYear() -> Int32
  • Set the year.

    Declaration

    Objective-C

    - (void)setYear:(int)value;

    Swift

    func setYear(_ value: Int32)
  • Get the month. Valid values 1..12

    Declaration

    Objective-C

    - (int)getMonth;

    Swift

    func getMonth() -> Int32
  • Set the month. Valid values 1..12

    Declaration

    Objective-C

    - (void)setMonth:(int)value;

    Swift

    func setMonth(_ value: Int32)
  • Get the day. Valid values 1..31

    Declaration

    Objective-C

    - (int)getDay;

    Swift

    func getDay() -> Int32
  • Set the day. Valid values 1..31

    Declaration

    Objective-C

    - (void)setDay:(int)value;

    Swift

    func setDay(_ value: Int32)
  • Get the day of the week. Valid values 1..7 (1 being Sunday).

    Declaration

    Objective-C

    - (int)getDayOfWeek;

    Swift

    func getDayOfWeek() -> Int32
  • Get the hour. Valid values 0..23

    Declaration

    Objective-C

    - (int)getHour;

    Swift

    func getHour() -> Int32
  • Set the hour. Valid values 0..23

    Declaration

    Objective-C

    - (void)setHour:(int)value;

    Swift

    func setHour(_ value: Int32)
  • Get the minute. Valid values 0..59

    Declaration

    Objective-C

    - (int)getMinute;

    Swift

    func getMinute() -> Int32
  • Set the minute. Valid values 0..59

    Declaration

    Objective-C

    - (void)setMinute:(int)value;

    Swift

    func setMinute(_ value: Int32)
  • Get the second. Valid values 0..59

    Declaration

    Objective-C

    - (int)getSecond;

    Swift

    func getSecond() -> Int32
  • Set the second. Valid values 0..59

    Declaration

    Objective-C

    - (void)setSecond:(int)value;

    Swift

    func setSecond(_ value: Int32)
  • Get the millisecond. Valid values 0..999

    Declaration

    Objective-C

    - (int)getMillisecond;

    Swift

    func getMillisecond() -> Int32
  • Set the millisecond. Valid values 0..999

    Declaration

    Objective-C

    - (void)setMillisecond:(int)value;

    Swift

    func setMillisecond(_ value: Int32)
  • Format string conform to ISO8601.

    Declaration

    Objective-C

    - (nonnull NSString *)toStr:(BOOL)utcTime;

    Swift

    func toStr(_ utcTime: Bool) -> String

    Parameters

    utcTime

    Time should be considered as UTC.

  • Get time zone in milliseconds

    Declaration

    Objective-C

    - (NSInteger)getTimeZoneMilliseconds;

    Swift

    func getTimeZoneMilliseconds() -> Int