Dela via


ContactDate Class

Definition

Represents an important date for a contact.

public ref class ContactDate sealed
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ContactDate final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class ContactDate final
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ContactDate
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ContactDate
function ContactDate()
Public NotInheritable Class ContactDate
Inheritance
Object Platform::Object IInspectable ContactDate
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)
App capabilities
contactsSystem

Remarks

Here is how to use the ContactDate properties to format date strings.

Insert sentinel values

  1. Construct a Windows.Globalization.Calendar.
  2. If year has a value, set year to that value, else set year to 2004 (a leap year so every day is valid).
  3. If month has a value, set month to that value, else set month to 1 (a month with every day valid).
  4. If day has a value, set day to that value (day will be set to some value automatically and we don't really care what it is so no need to explicitly set it).
  5. Get the Windows.Foundation.DateTime from the Calendar.

Build up a template to format

  1. If year has a value, append "year " to the template.
  2. If month has a value, append "month " to the template.
  3. If day has a value, append "day " to the template.
  4. Construct a Windows.Globalization.DateTimeFormatting.DateTimeFormatter with the template.
  5. Format by using the date time formatter and the Windows.Foundation.DateTime retrieved from the Calendar.

Constructors

ContactDate()

Initializes a new instance of a ContactDate class.

Properties

Day

Gets or sets the day for an important date for a contact.

Description

Gets or sets the description for an important date for a contact. The maximum string length for the description is 512 characters.

Kind

Gets or sets the kind of important date for a contact.

Month

Gets or sets the month for an important date for a contact.

Year

Gets or sets the year for an important date for a contact. This value must be convertible to a FILETIME structure.

Applies to

See also