Defines the person's anniversary (marital or work-related).
Code sample (creating)
VCard vcard = new VCard();
//date
Calendar c = Calendar.getInstance();
c.clear();
c.set(Calendar.YEAR, 1970);
c.set(Calendar.MONTH, Calendar.MARCH);
c.set(Calendar.DAY_OF_MONTH, 21);
Anniversary anniversary = new Anniversary(c.getTime());
vcard.setAnniversary(anniversary);
//partial date (e.g. just the month and date)
PartialDate date = PartialDate.date(null, 3, 21);
anniversary = new Anniversary(date); //March 21
vcard.setAnniversary(anniversary);
//plain text value
anniversary = new Anniversary("Over 20 years ago!");
vcard.setAnniversary(anniversary);
Code sample (retrieving)
VCard vcard = ...
Anniversary anniversary = vcard.getAnniversary();
Date date = anniversary.getDate();
if (date != null) {
//property value is a date
}
PartialDate partialDate = anniversary.getPartialDate();
if (partialDate != null) {
//property value is a partial date
int year = partialDate.getYear();
int month = partialDate.getMonth();
}
String text = anniversary.getText();
if (text != null) {
//property value is plain text
}
Property name:
ANNIVERSARY
Supported versions:
4.0