PTDate

@interface PTDate : PT_TRN_date

The Date class is a utility class used to simplify work with PDF date objects.

PDF defines a standard date format, which closely follows international standard ASN.1 (Abstract Syntax Notation One), A date is a string of the form (D:YYYYMMDDHHmmSSOHH'mm’); See PDF Reference Manual for details.

Date can be associated with a SDF/Cos date string using Date(Obj*) constructor or later using Date::Attach(Obj*) or Date::Update(Obj*) methods.

Date keeps a local date/time cache so it is necessary to call Date::Update() method if the changes to the Date should be saved in the attached Cos/SDF string.

  • Date default constructor.

    Declaration

    Objective-C

    - (instancetype)init;

    Swift

    init!()
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)initWithD: (PTObj*)d;

    Swift

    init!(d: PTObj!)
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)initWithYear: (unsigned short)year month:  (char)month day:  (char)day hour:  (char)hour minute:  (char)minute second:  (char)second;

    Swift

    init!(year: UInt16, month: CChar, day: CChar, hour: CChar, minute: CChar, second: CChar)
  • Indicates whether the Date is valid (non-null).

    Note

    If this method returns false the underlying SDF/Cos object is null and the Date object should be treated as null as well.

    Declaration

    Objective-C

    - (BOOL)IsValid;

    Swift

    func isValid() -> Bool

    Return Value

    True if this is a valid (non-null) Date; otherwise false.

  • Sets the date object to the current date and time. The method also updates associated SDF object.

    Declaration

    Objective-C

    - (void)SetCurrentTime;

    Swift

    func setCurrentTime()
  • Set the relationship of local time to Universal Time(UT), denoted by one of the characters +, -, or Z

    Declaration

    Objective-C

    - (void)SetUT:(char)ut;

    Swift

    func setUT(_ ut: CChar)

    Parameters

    ut

    the relationship of local time to Universal Time(UT),

  • Set the absolute value of the offset from UT in hours(00-23)

    Declaration

    Objective-C

    - (void)SetUTHour:(signed char)ut_hour;

    Swift

    func setUTHour(_ ut_hour: Int8)

    Parameters

    ut_hour

    the absolute value of the offset from UT in hours(00-23)

  • Set the absolute value of the offset from UT in minutes(00-59)

    Declaration

    Objective-C

    - (void)SetUTMinutes:(signed char)ut_minutes;

    Swift

    func setUTMinutes(_ ut_minutes: Int8)

    Parameters

    ut_minutes

    the absolute value of the offset from UT in minutes(00-59)

  • Attach the Cos/SDF object to the Date.

    Declaration

    Objective-C

    - (void)Attach:(PTObj *)d;

    Swift

    func attach(_ d: PTObj!)

    Parameters

    d

    - underlying Cos/SDF object. Must be an SDF::Str containing a PDF date object.

  • Saves changes made to the Date object in the attached (or specified) SDF/Cos string.

    Declaration

    Objective-C

    - (BOOL)Update:(PTObj *)d;

    Swift

    func update(_ d: PTObj!) -> Bool

    Parameters

    d

    - an optional parameter indicating a SDF string that should be updated and attached to this Date. If parameter d is NULL or is omitted, update is performed on previously attached Cos/SDF date.

    Return Value

    true if the attached Cos/SDF string was successfully updated, false otherwise.

  • Declaration

    Objective-C

    - (unsigned short)GetYear;

    Swift

    func getYear() -> UInt16

    Return Value

    The year.

  • Undocumented

    Declaration

    Objective-C

    - (unsigned char)GetMonth;

    Swift

    func getMonth() -> UInt8
  • Undocumented

    Declaration

    Objective-C

    - (unsigned char)GetDay;

    Swift

    func getDay() -> UInt8
  • Undocumented

    Declaration

    Objective-C

    - (unsigned char)GetHour;

    Swift

    func getHour() -> UInt8
  • Undocumented

    Declaration

    Objective-C

    - (unsigned char)GetMinute;

    Swift

    func getMinute() -> UInt8
  • Undocumented

    Declaration

    Objective-C

    - (unsigned char)GetSecond;

    Swift

    func getSecond() -> UInt8
  • Undocumented

    Declaration

    Objective-C

    - (unsigned char)GetUT;

    Swift

    func getUT() -> UInt8
  • Undocumented

    Declaration

    Objective-C

    - (unsigned char)GetUTHour;

    Swift

    func getUTHour() -> UInt8
  • Undocumented

    Declaration

    Objective-C

    - (unsigned char)GetUTMin;

    Swift

    func getUTMin() -> UInt8
  • The NSDate representation of the PTDate object.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSDate *NSDateValue;

    Swift

    var nsDateValue: Date? { get }